Check the returned name from blkid_get_devname in tune2fs and

e2fsck, and print an error if the requested LABEL/UUID does 
not exist (previously, we core dumped!)
bitmap-optimize
Theodore Ts'o 2003-11-21 09:10:29 -05:00
parent ef344e13d2
commit 817e49e3ce
4 changed files with 27 additions and 1 deletions

View 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

View 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);

View 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

View 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);
}