OSDN Git Service

Check the returned name from blkid_get_devname in tune2fs and
authorTheodore Ts'o <tytso@mit.edu>
Fri, 21 Nov 2003 14:10:29 +0000 (09:10 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 21 Nov 2003 14:10:29 +0000 (09:10 -0500)
e2fsck, and print an error if the requested LABEL/UUID does
not exist (previously, we core dumped!)

e2fsck/ChangeLog
e2fsck/unix.c
misc/ChangeLog
misc/tune2fs.c

index 79a9bcd..d39d458 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-12  Theodore Ts'o  <tytso@mit.edu>
+
+       * unix.c (PRS): Check the returned name from blkid_get_devname and
+               print an error if the requested LABEL/UUID does not exist.
+       
 2003-09-03  Theodore Ts'o  <tytso@mit.edu>
 
        * pass1.c (mark_table_blocks): Use the new function
index 33722e3..9109773 100644 (file)
@@ -638,6 +638,11 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
            !cflag && !swapfs && !(ctx->options & E2F_OPT_COMPRESS_DIRS))
                ctx->options |= E2F_OPT_READONLY;
        ctx->filesystem_name = blkid_get_devname(ctx->blkid, argv[optind], 0);
+       if (!ctx->filesystem_name) {
+               com_err(ctx->program_name, 0, _("Unable to resolve '%s'"), 
+                       argv[optind]);
+               fatal_error(ctx, 0);
+       }
        if (extended_opts)
                parse_extended_opts(ctx, extended_opts);
        
index 98ec820..03e6cc1 100644 (file)
@@ -1,3 +1,9 @@
+2003-09-13  Theodore Ts'o  <tytso@mit.edu>
+        * tune2fs.c (parse_e2label_options, parse_tune2fs_options,
+        do_findfs): Check the returned name from blkid_get_devname and
+                print an error if the requested LABEL/UUID does not exist.
 2003-09-03  Theodore Ts'o  <tytso@mit.edu>
  
         * dumpe2fs.c (list_desc): Use ext2fs_super_and_bgd_loc to
index a2d22b6..f95aed4 100644 (file)
@@ -441,6 +441,11 @@ static void parse_e2label_options(int argc, char ** argv)
                exit(1);
        }
        device_name = blkid_get_devname(NULL, argv[1], NULL);
+       if (!device_name) {
+               com_err("e2label", 0, _("Unable to resolve '%s'"), 
+                       argv[1]);
+               exit(1);
+       }
        if (argc == 3) {
                open_flag = EXT2_FLAG_RW | EXT2_FLAG_JOURNAL_DEV_OK;
                L_flag = 1;
@@ -691,6 +696,11 @@ static void parse_tune2fs_options(int argc, char **argv)
        if (!open_flag && !l_flag)
                usage();
        device_name = blkid_get_devname(NULL, argv[optind], NULL);
+       if (!device_name) {
+               com_err("tune2fs", 0, _("Unable to resolve '%s'"), 
+                       argv[optind]);
+               exit(1);
+       }
 }
 
 void do_findfs(int argc, char **argv)
@@ -704,7 +714,7 @@ void do_findfs(int argc, char **argv)
        }
        dev = blkid_get_devname(NULL, argv[1], NULL);
        if (!dev) {
-               fprintf(stderr, "Filesystem matching %s not found\n"
+               com_err("findfs", 0, _("Unable to resolve '%s'")
                        argv[1]);
                exit(1);
        }