On 06/23/2017 07:28 PM, J William Piggott wrote:
On 06/22/2017 04:43 PM, Ruediger Meier wrote:
From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
Found by grep:
grep -l "\bEXIT_\|exit *( *[0-9][0-9] *)\|strutils\.h" $(grep -L \
strutils_set_exitcode $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c"))
The Command shows also some false positives (fstrim.c,
context_mount.c, ...)
Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
---
disk-utils/fsck.cramfs.c | 2 ++
disk-utils/fsck.minix.c | 2 ++
disk-utils/mkfs.cramfs.c | 2 ++
disk-utils/mkfs.minix.c | 2 ++
sys-utils/flock.c | 2 ++
sys-utils/hwclock.c | 2 ++
sys-utils/mount.c | 2 ++
7 files changed, 14 insertions(+)
--- >8
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 5433cd0..325106a 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -1326,6 +1326,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);
If we keep this it needs to be: #if defined(__linux__) && defined(__alpha__)
I think the non-needed strutils_set_exitcode() call on non-alpha doesn't hurt
but would ensure that it stays correct if someone would use more *_or_err
functions in future. Otherwise we should also have
#if defined(__linux__) && defined(__alpha__)
# include "strutils.h"
#endif
In general I don't really like that we have soo many exiting functions at all.
They all should take an exit_code argument at least. Like errx() or
errtryhelp(). On average this would look less ugly than all these hacky
exit code re-defines.
I think the default EXIT_FAILURE is fine for this case.
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html