mirror of
https://github.com/kdave/btrfs-progs
synced 2025-05-08 19:07:56 +00:00
btrfs-progs: mkfs: duplicate argument for --rootdir path
The source dir points to the argv data, we should make a copy to be sure it won't change due to further processing. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
54fe8e648a
commit
c33c2c66b3
@ -1114,7 +1114,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
|
|||||||
PACKAGE_STRING);
|
PACKAGE_STRING);
|
||||||
goto success;
|
goto success;
|
||||||
case 'r':
|
case 'r':
|
||||||
source_dir = optarg;
|
free(source_dir);
|
||||||
|
source_dir = strdup(optarg);
|
||||||
source_dir_set = true;
|
source_dir_set = true;
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
@ -1748,6 +1749,7 @@ out:
|
|||||||
|
|
||||||
btrfs_close_all_devices();
|
btrfs_close_all_devices();
|
||||||
free(label);
|
free(label);
|
||||||
|
free(source_dir);
|
||||||
|
|
||||||
return !!ret;
|
return !!ret;
|
||||||
error:
|
error:
|
||||||
@ -1755,6 +1757,7 @@ error:
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
free(label);
|
free(label);
|
||||||
|
free(source_dir);
|
||||||
exit(1);
|
exit(1);
|
||||||
success:
|
success:
|
||||||
exit(0);
|
exit(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user