A failed system call returns -1 with errno set, so lets differentiate
a failed system call from not finding a command at all. This suppresses
large help messages on any generic system call failure.
Signed-off-by: Keith Busch <keith.busch@intel.com>
setlocale(LC_ALL, "");
ret = handle_plugin(argc - 1, &argv[1], nvme.extensions);
- if (ret == -1)
+ if (ret == -ENOTTY)
general_help(&builtin);
return ret;
/* Check extensions only if this is running the built-in plugin */
if (plugin->name) {
printf("ERROR: Invalid sub-command '%s' for plugin %s\n", str, plugin->name);
- return -1;
+ return -ENOTTY;
}
extension = plugin->next;
extension = extension->next;
}
printf("ERROR: Invalid sub-command '%s'\n", str);
- return -1;
+ return -ENOTTY;
}