If the arg string is of the form <ino>, allow it
for ncheck.
Improve the error message, use "Invalid inode number"
instead of "Bad inode", which implies the inode
content being bad.
Change-Id: Ib6d7eb53342d93c9e8ecf25835d8ff65bc340980
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/44388
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
iw.names_left = 0;
for (i=0; i < argc; i++) {
- iw.iarray[i] = strtol(argv[i], &tmp, 0);
+ char *str = argv[i];
+ int len = strlen(str);
+
+ if ((len > 2) && (str[0] == '<') && (str[len-1] == '>')) {
+ str[len-1] = '\0';
+ str++;
+ }
+ iw.iarray[i] = strtol(str, &tmp, 0);
if (*tmp) {
- com_err("ncheck", 0, "Bad inode - %s", argv[i]);
+ if (str != argv[i]) {
+ str--;
+ str[len-1] = '>';
+ }
+ com_err("ncheck", 0, "Invalid inode number - '%s'",
+ argv[i]);
goto error_out;
}
if (debugfs_read_inode(iw.iarray[i], &inode, *argv))