From nobody Wed Oct 20 09:04:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B80051805A05; Wed, 20 Oct 2021 09:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ4Rd4prqz3rl9; Wed, 20 Oct 2021 09:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A7B524A4A; Wed, 20 Oct 2021 09:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19K94DeZ011790; Wed, 20 Oct 2021 09:04:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K94DTj011789; Wed, 20 Oct 2021 09:04:13 GMT (envelope-from git) Date: Wed, 20 Oct 2021 09:04:13 GMT Message-Id: <202110200904.19K94DTj011789@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 68914dab436a - main - timeout: eliminate usage of sysexits List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68914dab436acf166b8f851c4fa0acecb7c7c510 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=68914dab436acf166b8f851c4fa0acecb7c7c510 commit 68914dab436acf166b8f851c4fa0acecb7c7c510 Author: Baptiste Daroussin AuthorDate: 2021-10-20 08:39:34 +0000 Commit: Baptiste Daroussin CommitDate: 2021-10-20 08:39:34 +0000 timeout: eliminate usage of sysexits It brings no value at all the sysexits and maybe misleading as the return value of timeout(1) matters. --- usr.bin/timeout/timeout.c | 17 ++++++++--------- 1 file 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 #include #include -#include #include #define EXIT_TIMEOUT 124 @@ -58,7 +57,7 @@ usage(void) " [--kill-after time | -k time] [--foreground] " " \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)