aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2021-10-20 08:39:34 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2021-10-20 08:39:34 +0000
commit68914dab436acf166b8f851c4fa0acecb7c7c510 (patch)
tree7911a758a355b7c579c5090a2346965cc82bf25e
parent6ae38ab45396edaea26b4725e0c7db8cffa5f208 (diff)
downloadsrc-68914dab436acf166b8f851c4fa0acecb7c7c510.tar.gz
src-68914dab436acf166b8f851c4fa0acecb7c7c510.zip
timeout: eliminate usage of sysexits
It brings no value at all the sysexits and maybe misleading as the return value of timeout(1) matters.
-rw-r--r--usr.bin/timeout/timeout.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c
index d682541e9162..6af795ba7408 100644
--- a/usr.bin/timeout/timeout.c
+++ b/usr.bin/timeout/timeout.c
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sysexits.h>
#include <unistd.h>
#define EXIT_TIMEOUT 124
@@ -58,7 +57,7 @@ usage(void)
" [--kill-after time | -k time] [--foreground] <duration> <command>"
" <arg ...>\n", getprogname());
- exit(EX_USAGE);
+ exit(EXIT_FAILURE);
}
static double
@@ -75,7 +74,7 @@ parse_duration(const char *duration)
return (ret);
if (end != NULL && *(end + 1) != '\0')
- errx(EX_USAGE, "invalid duration");
+ errx(125, "invalid duration");
switch (*end) {
case 's':
@@ -156,7 +155,7 @@ set_interval(double iv)
tim.it_value.tv_usec = (suseconds_t)(iv * 1000000UL);
if (setitimer(ITIMER_REAL, &tim, NULL) == -1)
- err(EX_OSERR, "setitimer()");
+ err(EXIT_FAILURE, "setitimer()");
}
int
@@ -229,7 +228,7 @@ main(int argc, char **argv)
if (!foreground) {
/* Acquire a reaper */
if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1)
- err(EX_OSERR, "Fail to acquire the reaper");
+ err(EXIT_FAILURE, "Fail to acquire the reaper");
}
memset(&signals, 0, sizeof(signals));
@@ -247,14 +246,14 @@ main(int argc, char **argv)
for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i ++)
if (signums[i] != -1 && signums[i] != 0 &&
sigaction(signums[i], &signals, NULL) == -1)
- err(EX_OSERR, "sigaction()");
+ err(EXIT_FAILURE, "sigaction()");
signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
pid = fork();
if (pid == -1)
- err(EX_OSERR, "fork()");
+ err(EXIT_FAILURE, "fork()");
else if (pid == 0) {
/* child process */
signal(SIGTTIN, SIG_DFL);
@@ -270,7 +269,7 @@ main(int argc, char **argv)
}
if (sigprocmask(SIG_BLOCK, &signals.sa_mask, NULL) == -1)
- err(EX_OSERR, "sigprocmask()");
+ err(EXIT_FAILURE, "sigprocmask()");
/* parent continues here */
set_interval(first_kill);
@@ -344,7 +343,7 @@ main(int argc, char **argv)
while (!child_done && wait(&pstat) == -1) {
if (errno != EINTR)
- err(EX_OSERR, "waitpid()");
+ err(EXIT_FAILURE, "waitpid()");
}
if (!foreground)