If the ncheck argument is of the form "<ino>", allow it for ncheck
for consistency with other commands that accept an inode number.
Improve the error message, use "Invalid inode number" instead
of "Bad inode", which implies the inode content being bad.
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
iw.names_left = 0;
for (i=0; i < argc; i++) {
- iw.iarray[i] = strtol(argv[i], &tmp, 0);
- if (*tmp) {
- com_err("ncheck", 0, "Bad inode - %s", argv[i]);
+ char *str = argv[i];
+ int len = strlen(str);
+
+ if ((len > 2) && (str[0] == '<') && (str[len - 1] == '>'))
+ str++;
+ iw.iarray[i] = strtol(str, &tmp, 0);
+ if (*tmp && (str == argv[i] || *tmp != '>')) {
+ com_err("ncheck", 0, "Invalid inode number - '%s'",
+ argv[i]);
goto error_out;
}
if (debugfs_read_inode(iw.iarray[i], &inode, *argv))