diff options
author | Karel Zak | 2017-06-26 13:47:04 +0200 |
---|---|---|
committer | Karel Zak | 2017-06-26 13:47:04 +0200 |
commit | dfdb1ca8186cfc84ad95d5e356334ce8633a28f7 (patch) | |
tree | 37b568d27fa12194ec63f8122901fc8b2fd7bf1d /sys-utils | |
parent | Merge branch 'usage-part1' of https://github.com/rudimeier/util-linux (diff) | |
parent | misc: fix optutils.h related exit codes (diff) | |
download | kernel-qcow2-util-linux-dfdb1ca8186cfc84ad95d5e356334ce8633a28f7.tar.gz kernel-qcow2-util-linux-dfdb1ca8186cfc84ad95d5e356334ce8633a28f7.tar.xz kernel-qcow2-util-linux-dfdb1ca8186cfc84ad95d5e356334ce8633a28f7.zip |
Merge branch 'fix-exit-codes' of https://github.com/rudimeier/util-linux
* 'fix-exit-codes' of https://github.com/rudimeier/util-linux:
misc: fix optutils.h related exit codes
misc: fix xalloc.h related exit codes
misc: fix more strutils related exit codes
lib: fix strutils.h, remove STRTOXX_EXIT_CODE
misc: fix some broken exit codes
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/flock.c | 2 | ||||
-rw-r--r-- | sys-utils/hwclock.c | 3 | ||||
-rw-r--r-- | sys-utils/mount.c | 6 | ||||
-rw-r--r-- | sys-utils/tunelp.c | 10 | ||||
-rw-r--r-- | sys-utils/umount.c | 6 |
5 files changed, 22 insertions, 5 deletions
diff --git a/sys-utils/flock.c b/sys-utils/flock.c index 50194bdb9..003a12618 100644 --- a/sys-utils/flock.c +++ b/sys-utils/flock.c @@ -170,6 +170,8 @@ int main(int argc, char *argv[]) textdomain(PACKAGE); atexit(close_stdout); + strutils_set_exitcode(EX_USAGE); + if (argc < 2) usage(EX_USAGE); diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 0f604960c..07ad61385 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -71,6 +71,7 @@ #include <unistd.h> #define OPTUTILS_EXIT_CODE EX_USAGE +#define XALLOC_EXIT_CODE EX_OSERR #include "c.h" #include "closestream.h" @@ -1326,6 +1327,8 @@ int main(int argc, char **argv) }; int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT; + strutils_set_exitcode(EX_USAGE); + /* Remember what time we were invoked */ gettimeofday(&startup_time, NULL); diff --git a/sys-utils/mount.c b/sys-utils/mount.c index 4d7a5fc73..ffe294e3f 100644 --- a/sys-utils/mount.c +++ b/sys-utils/mount.c @@ -36,10 +36,12 @@ #include "c.h" #include "env.h" #include "strutils.h" -#include "xalloc.h" #include "closestream.h" #include "canonicalize.h" +#define XALLOC_EXIT_CODE MNT_EX_SYSERR +#include "xalloc.h" + #define OPTUTILS_EXIT_CODE MNT_EX_USAGE #include "optutils.h" @@ -534,6 +536,8 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); + strutils_set_exitcode(MNT_EX_USAGE); + mnt_init_debug(0); cxt = mnt_new_context(); if (!cxt) diff --git a/sys-utils/tunelp.c b/sys-utils/tunelp.c index 8cfbe80a2..2749dd1c8 100644 --- a/sys-utils/tunelp.c +++ b/sys-utils/tunelp.c @@ -71,13 +71,15 @@ #include "lp.h" #include "nls.h" -#include "xalloc.h" #include "closestream.h" +#include "strutils.h" -#define STRTOXX_EXIT_CODE 3 +#define EXIT_LP_MALLOC 2 +#define EXIT_LP_BADVAL 3 #define EXIT_LP_IO_ERR 4 -#include "strutils.h" +#define XALLOC_EXIT_CODE EXIT_LP_MALLOC +#include "xalloc.h" struct command { long op; @@ -144,6 +146,8 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); + strutils_set_exitcode(EXIT_LP_BADVAL); + if (argc < 2) print_usage(stderr); diff --git a/sys-utils/umount.c b/sys-utils/umount.c index ed8fd4fe2..57140a660 100644 --- a/sys-utils/umount.c +++ b/sys-utils/umount.c @@ -32,12 +32,16 @@ #include "nls.h" #include "c.h" #include "env.h" -#include "optutils.h" #include "closestream.h" #include "pathnames.h" #include "canonicalize.h" + +#define XALLOC_EXIT_CODE MNT_EX_SYSERR #include "xalloc.h" +#define OPTUTILS_EXIT_CODE MNT_EX_USAGE +#include "optutils.h" + static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__)), const char *filename, int line) { |