mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-11 03:31:17 +00:00
btrfs-progs: convert: use on-stack buffer for subvol name dir
Get rid of dynamic allocation. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
6b74f2fbe3
commit
4927a9b268
@ -1184,7 +1184,7 @@ static int do_convert(const char *devname, int datacsum, int packing,
|
||||
struct btrfs_root *image_root;
|
||||
struct btrfs_convert_context cctx;
|
||||
struct btrfs_key key;
|
||||
char *subvol_name = NULL;
|
||||
char subvol_name[SOURCE_FS_NAME_LEN + 8];
|
||||
struct task_ctx ctx;
|
||||
char features_buf[64];
|
||||
struct btrfs_mkfs_config mkfs_cfg;
|
||||
@ -1252,12 +1252,8 @@ static int do_convert(const char *devname, int datacsum, int packing,
|
||||
}
|
||||
|
||||
printf("creating %s image file\n", cctx.convert_ops->name);
|
||||
ret = asprintf(&subvol_name, "%s_saved", cctx.convert_ops->name);
|
||||
if (ret < 0) {
|
||||
error("memory allocation failure for subvolume name: %s_saved",
|
||||
snprintf(subvol_name, sizeof(subvol_name), "%s_saved",
|
||||
cctx.convert_ops->name);
|
||||
goto fail;
|
||||
}
|
||||
key.objectid = CONV_IMAGE_SUBVOL_OBJECTID;
|
||||
key.offset = (u64)-1;
|
||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||
@ -1298,8 +1294,6 @@ static int do_convert(const char *devname, int datacsum, int packing,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
free(subvol_name);
|
||||
|
||||
memset(root->fs_info->super_copy->label, 0, BTRFS_LABEL_SIZE);
|
||||
if (copylabel == 1) {
|
||||
__strncpy_null(root->fs_info->super_copy->label,
|
||||
|
Loading…
Reference in New Issue
Block a user