Whamcloud - gitweb
mke2fs.c: return error when failed to populate fs
authorRobert Yang <liezhi.yang@windriver.com>
Mon, 14 Apr 2014 15:43:24 +0000 (11:43 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 14 Apr 2014 15:43:27 +0000 (11:43 -0400)
We need return retval when "mke2fs -d" failed, otherwise the "$?"
would be 0 which is misleading.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
misc/mke2fs.c

index aecd5d5..60e7466 100644 (file)
@@ -2990,10 +2990,11 @@ no_journal:
 
                retval = populate_fs(fs, EXT2_ROOT_INO, root_dir,
                                     EXT2_ROOT_INO);
-               if (retval)
-                       fprintf(stderr, "%s",
-                               _("\nError while populating file system"));
-               else if (!quiet)
+               if (retval) {
+                       com_err(program_name, retval, "%s",
+                               _("\nError while populating file system\n"));
+                       exit(1);
+               } else if (!quiet)
                        printf("%s", _("done\n"));
        }