Fix the debugfs commands htree_dump, dx_hash, and list_dir so they print a
print a usage message when an illegal option character is given.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+2006-04-27 Theodore Ts'o <tytso@mit.edu>
+
+ * htree.c (do_htree_dump, do_dx_hash), ls.c (do_list_dir): Add
+ missing default case in the getopt() while/switch loop so
+ that we print a usage() statement when the user specified
+ an illegal option.
+
2006-03-18 Theodore Ts'o <tytso@mit.edu>
* debugfs.c, htree.c, unused.c: Change printf statements to use
case 'l':
long_opt++;
break;
+ default:
+ goto print_usage;
}
}
if (argc > optind+1) {
+ print_usage:
com_err(0, 0, "Usage: htree_dump [-l] file");
goto errout;
}
case 'h':
hash_version = atoi(optarg);
break;
+ default:
+ goto print_usage;
}
}
if (optind != argc-1) {
+ print_usage:
com_err(argv[0], 0, "usage: dx_hash filename");
return;
}
case 'd':
ls.options |= DELETED_OPT;
break;
+ default:
+ goto print_usage;
}
}
if (argc > optind+1) {
+ print_usage:
com_err(0, 0, "Usage: ls [-l] [-d] file");
return;
}