Whamcloud - gitweb
libext2fs: Replace use of sprintf with strcpy/strcat to help SILO
authorTheodore Ts'o <tytso@mit.edu>
Fri, 22 Aug 2008 14:37:18 +0000 (10:37 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 22 Aug 2008 14:37:18 +0000 (10:37 -0400)
Some bootloaders, like SILO, don't provide sprintf in their limited
bootloader environment.  Since the uses in rw_bitmaps.c is only doing
sprintf("foo %s"), it's easy to replace that usage with strcpy/strcat.

Addresses-Sourceforge-Bug: #2049120

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/initialize.c
lib/ext2fs/rw_bitmaps.c

index e9bfe49..5ed4c06 100644 (file)
@@ -353,12 +353,14 @@ ipg_retry:
        if (retval)
                goto cleanup;
        
-       sprintf(buf, "block bitmap for %s", fs->device_name);
+       strcpy(buf, "block bitmap for ");
+       strcat(buf, fs->device_name);
        retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map);
        if (retval)
                goto cleanup;
        
-       sprintf(buf, "inode bitmap for %s", fs->device_name);
+       strcpy(buf, "inode bitmap for ");
+       strcat(buf, fs->device_name);
        retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map);
        if (retval)
                goto cleanup;
index d3bdc2a..d4e94da 100644 (file)
@@ -164,7 +164,8 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
        if (do_block) {
                if (fs->block_map)
                        ext2fs_free_block_bitmap(fs->block_map);
-               sprintf(buf, "block bitmap for %s", fs->device_name);
+               strcpy(buf, "block bitmap for ");
+               strcat(buf, fs->device_name);
                retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map);
                if (retval)
                        goto cleanup;
@@ -177,7 +178,8 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
        if (do_inode) {
                if (fs->inode_map)
                        ext2fs_free_inode_bitmap(fs->inode_map);
-               sprintf(buf, "inode bitmap for %s", fs->device_name);
+               strcpy(buf, "inode bitmap for ");
+               strcat(buf, fs->device_name);
                retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map);
                if (retval)
                        goto cleanup;