All of lore.kernel.org
 help / color / mirror / Atom feed
* [ndctl PATCH] ndctl: Bail out with unkown command in case of an unknown command
@ 2016-03-14 15:53 Johannes Thumshirn
  2016-03-14 15:56 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Thumshirn @ 2016-03-14 15:53 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm

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@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;
 }
-- 
2.7.2

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [ndctl PATCH] ndctl: Bail out with unkown command in case of an unknown command
  2016-03-14 15:53 [ndctl PATCH] ndctl: Bail out with unkown command in case of an unknown command Johannes Thumshirn
@ 2016-03-14 15:56 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2016-03-14 15:56 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: linux-nvdimm

On Mon, Mar 14, 2016 at 8:53 AM, Johannes Thumshirn <jthumshirn@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@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.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-14 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-14 15:53 [ndctl PATCH] ndctl: Bail out with unkown command in case of an unknown command Johannes Thumshirn
2016-03-14 15:56 ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.