On Mon, Mar 14, 2016 at 8:53 AM, Johannes Thumshirn <jthumshirn(a)suse.de> wrote:
handle_internal_command() only returns to main if it doesn't find
the
specified command and does not set an errno.
When running an unknown command you get the following error message:
$ ./ndctl asd
Failed to run command 'asd': Success
Instead of a more appropriate:
$ ./ndctl asd
Unknown command: 'asd'
Signed-off-by: Johannes Thumshirn <jthumshirn(a)suse.de>
---
ndctl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/ndctl.c b/ndctl.c
index ded1588..18b5dc6 100644
--- a/ndctl.c
+++ b/ndctl.c
@@ -159,8 +159,7 @@ int main(int argc, const char **argv)
goto out;
}
handle_internal_command(argc, argv);
- fprintf(stderr, "Failed to run command '%s': %s\n",
- argv[0], strerror(errno));
+ fprintf(stderr, "Unknown command: '%s'\n", argv[0]);
out:
return 1;
Looks good to me, applied.