git: d9e4b110fe91 - stable/14 - timeout(1): Use _exit(2) instead of err() in child if exec failed
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 16 Jun 2025 08:53:56 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d9e4b110fe919c1e96ba3bd5fdba177f03d365c5 commit d9e4b110fe919c1e96ba3bd5fdba177f03d365c5 Author: Aaron LI <aly@aaronly.me> AuthorDate: 2025-04-02 11:23:06 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-06-16 08:51:51 +0000 timeout(1): Use _exit(2) instead of err() in child if exec failed (cherry picked from commit 35503fe28eb51ef606cf4ae077a96b3c717199d3) --- bin/timeout/timeout.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 83893ba0a601..1817ef24995f 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -178,7 +178,7 @@ main(int argc, char **argv) { int ch; int foreground, preserve; - int error, pstat, status; + int pstat, status; int killsig = SIGTERM; size_t i; pid_t pid, cpid; @@ -280,13 +280,9 @@ main(int argc, char **argv) signal(SIGTTIN, SIG_DFL); signal(SIGTTOU, SIG_DFL); - error = execvp(argv[0], argv); - if (error == -1) { - if (errno == ENOENT) - err(EXIT_CMD_NOENT, "exec(%s)", argv[0]); - else - err(EXIT_CMD_ERROR, "exec(%s)", argv[0]); - } + execvp(argv[0], argv); + warn("exec(%s)", argv[0]); + _exit(errno == ENOENT ? EXIT_CMD_NOENT : EXIT_CMD_ERROR); } if (sigprocmask(SIG_BLOCK, &signals.sa_mask, NULL) == -1)