diff options
author | randi <randi@FreeBSD.org> | 2010-10-10 20:37:38 +0000 |
---|---|---|
committer | randi <randi@FreeBSD.org> | 2010-10-10 20:37:38 +0000 |
commit | 0c20df57142d35275da70129f25b2bd2a67d7d60 (patch) | |
tree | cc5aaf64bb84c1ca82534a7526a5ce4a07cb4a67 | |
parent | 598579df4eadd7452320cc91a3ba2916ce3f1a8e (diff) | |
download | FreeBSD-src-0c20df57142d35275da70129f25b2bd2a67d7d60.zip FreeBSD-src-0c20df57142d35275da70129f25b2bd2a67d7d60.tar.gz |
Report subcommand handler errors in mfiutil/mptutil so that tools that
invoke the utilities can robustly report errors.
Submitted by: gcooper
Reviewed by: jhb
Approved by: cperciva (mentor)
MFC after: 1 week
-rw-r--r-- | usr.sbin/mfiutil/mfiutil.c | 8 | ||||
-rw-r--r-- | usr.sbin/mptutil/mptutil.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/mfiutil/mfiutil.c b/usr.sbin/mfiutil/mfiutil.c index d091fb6..7c0a117 100644 --- a/usr.sbin/mfiutil/mfiutil.c +++ b/usr.sbin/mfiutil/mfiutil.c @@ -125,10 +125,12 @@ main(int ac, char **av) SET_FOREACH(cmd, MFI_DATASET(top)) { if (strcmp((*cmd)->name, av[0]) == 0) { - (*cmd)->handler(ac, av); - return (0); + if ((*cmd)->handler(ac, av)) + return (1); + else + return (0); } } warnx("Unknown command %s.", av[0]); - return (0); + return (1); } diff --git a/usr.sbin/mptutil/mptutil.c b/usr.sbin/mptutil/mptutil.c index e7b5806..63e8efa 100644 --- a/usr.sbin/mptutil/mptutil.c +++ b/usr.sbin/mptutil/mptutil.c @@ -114,10 +114,12 @@ main(int ac, char **av) SET_FOREACH(cmd, MPT_DATASET(top)) { if (strcmp((*cmd)->name, av[0]) == 0) { - (*cmd)->handler(ac, av); - return (0); + if ((*cmd)->handler(ac, av)) + return (1); + else + return (0); } } warnx("Unknown command %s.", av[0]); - return (0); + return (1); } |