From 2d40a91e171ec1cfb6bb80a0e788e0740bb1d747 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 22 Aug 2008 10:37:18 -0400 Subject: [PATCH] libext2fs: Replace use of sprintf with strcpy/strcat to help SILO 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" --- lib/ext2fs/initialize.c | 6 ++++-- lib/ext2fs/rw_bitmaps.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c index e9bfe4938..5ed4c06a1 100644 --- a/lib/ext2fs/initialize.c +++ b/lib/ext2fs/initialize.c @@ -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; diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c index d3bdc2aca..d4e94da68 100644 --- a/lib/ext2fs/rw_bitmaps.c +++ b/lib/ext2fs/rw_bitmaps.c @@ -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; -- 2.47.3