summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-06-18 22:36:32 +0000
committermidipix <writeonce@midipix.org>2019-06-18 22:37:18 +0000
commit50a5526f8e7803dbbb77f176b708b35cf412ad99 (patch)
tree022889bf9e749aa2e5aabd04d611f53d4d8afac5
parent66dce28eb51debc1ca5bdde9c85ede3127a0969f (diff)
downloadslibtool-50a5526f8e7803dbbb77f176b708b35cf412ad99.tar.bz2
slibtool-50a5526f8e7803dbbb77f176b708b35cf412ad99.tar.xz
driver: set correct return value upon --help or --help=all.
-rw-r--r--src/driver/slbt_amain.c2
-rw-r--r--src/driver/slbt_driver_ctx.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c
index 2e59849..65d61de 100644
--- a/src/driver/slbt_amain.c
+++ b/src/driver/slbt_amain.c
@@ -177,7 +177,7 @@ int slbt_main(char ** argv, char ** envp, const struct slbt_fd_ctx * fdctx)
/* driver context */
if ((ret = slbt_get_driver_ctx(argv,envp,flags,fdctx,&dctx)))
return (ret == SLBT_USAGE)
- ? !argv || !argv[0] || !argv[1]
+ ? !argv || !argv[0] || !argv[1] || !argv[2]
: SLBT_ERROR;
if (dctx->cctx->drvflags & SLBT_DRIVER_VERSION)
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index f5e7ef2..ec47db8 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -1270,11 +1270,12 @@ int slbt_get_driver_ctx(
switch (entry->tag) {
case TAG_HELP:
case TAG_HELP_ALL:
- if (flags & SLBT_DRIVER_VERBOSITY_USAGE)
- return slbt_driver_usage(
+ return (flags & SLBT_DRIVER_VERBOSITY_USAGE)
+ ? slbt_driver_usage(
fdctx->fdout,program,
entry->arg,optv,
- meta,&sargv);
+ meta,&sargv)
+ : SLBT_USAGE;
case TAG_VERSION:
cctx.drvflags |= SLBT_DRIVER_VERSION;