@@ -1025,7 +1025,6 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
10251025 char * label = NULL ;
10261026 int nr_global_roots = sysconf (_SC_NPROCESSORS_ONLN );
10271027 char * source_dir = NULL ;
1028- bool source_dir_set = false;
10291028
10301029 cpu_detect_flags ();
10311030 hash_init_accel ();
@@ -1172,7 +1171,6 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
11721171 case 'r' :
11731172 free (source_dir );
11741173 source_dir = strdup (optarg );
1175- source_dir_set = true;
11761174 break ;
11771175 case 'U' :
11781176 strncpy (fs_uuid , optarg ,
@@ -1221,11 +1219,11 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
12211219
12221220 opt_zoned = !!(features .incompat_flags & BTRFS_FEATURE_INCOMPAT_ZONED );
12231221
1224- if (source_dir_set && device_count > 1 ) {
1222+ if (source_dir && device_count > 1 ) {
12251223 error ("the option -r is limited to a single device" );
12261224 goto error ;
12271225 }
1228- if (shrink_rootdir && ! source_dir_set ) {
1226+ if (shrink_rootdir && source_dir == NULL ) {
12291227 error ("the option --shrink must be used with --rootdir" );
12301228 goto error ;
12311229 }
@@ -1246,7 +1244,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
12461244 for (i = 0 ; i < device_count ; i ++ ) {
12471245 file = argv [optind ++ ];
12481246
1249- if (source_dir_set && path_exists (file ) == 0 )
1247+ if (source_dir && path_exists (file ) == 0 )
12501248 ret = 0 ;
12511249 else if (path_is_block_device (file ) == 1 )
12521250 ret = test_dev_for_mkfs (file , force_overwrite );
@@ -1352,7 +1350,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
13521350 if (opt_zoned ) {
13531351 const int blkid_version = blkid_get_library_version (NULL , NULL );
13541352
1355- if (source_dir_set ) {
1353+ if (source_dir ) {
13561354 error ("the option -r and zoned mode are incompatible" );
13571355 exit (1 );
13581356 }
@@ -1388,7 +1386,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
13881386 *
13891387 * This must be done before minimal device size checks.
13901388 */
1391- if (source_dir_set ) {
1389+ if (source_dir ) {
13921390 int oflags = O_RDWR ;
13931391 struct stat statbuf ;
13941392 int fd ;
@@ -1722,7 +1720,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
17221720 goto out ;
17231721 }
17241722
1725- if (source_dir_set ) {
1723+ if (source_dir ) {
17261724 ret = btrfs_mkfs_fill_dir (source_dir , root , bconf .verbose );
17271725 if (ret ) {
17281726 error ("error while filling filesystem: %d" , ret );
0 commit comments