diff options
author | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2023-11-03 19:16:32 +0000 |
---|---|---|
committer | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2023-11-03 19:16:32 +0000 |
commit | ef92e35df0d1ab187b1c41fce69465947bd2e5ce (patch) | |
tree | 329199b256b807b7e6b9d4fcaeea2a277f5ddb29 /usr.bin/timeout/timeout.c | |
parent | e7308a0d3675330f451358dadac4bc01d8599607 (diff) |
timeout(1): align execvp(3) failure statuses with GNU timeout
Align our exit statuses with those of GNU timeout in the execvp(3)
failure case. Exit with 127 if the utility is not found. Exit with
126 if we cannot execute the utility for any other reason.
While here, the child should _exit(2) instead of calling exit(3) via
err(3).
Update the manpage accordingly.
With input from millert@ and deraadt@.
Link: https://marc.info/?l=openbsd-tech&m=169739592322978&w=2
ok millert@
Diffstat (limited to 'usr.bin/timeout/timeout.c')
-rw-r--r-- | usr.bin/timeout/timeout.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c index fb4d9c81970..0bf7d5d41c5 100644 --- a/usr.bin/timeout/timeout.c +++ b/usr.bin/timeout/timeout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timeout.c,v 1.25 2023/01/13 06:53:04 cheloha Exp $ */ +/* $OpenBSD: timeout.c,v 1.26 2023/11/03 19:16:31 cheloha Exp $ */ /* * Copyright (c) 2021 Job Snijders <job@openbsd.org> @@ -260,7 +260,8 @@ main(int argc, char **argv) signal(SIGTTOU, SIG_DFL); execvp(argv[0], argv); - err(1, "%s", argv[0]); + warn("%s", argv[0]); + _exit(errno == ENOENT ? 127 : 126); } /* parent continues here */ |