On Sun, Oct 15, 2023 at 01:48:13PM -0600, Todd C. Miller wrote:
> On Sun, 15 Oct 2023 13:53:46 -0500, Scott Cheloha wrote:
> 
> > Align timeout(1)'s execvp(3) failure statuses with those of GNU
> > timeout.  127 for ENOENT, 126 for everything else.
> 
> Looks correct to me.  OK millert@

Per deraadt@, update EXIT STATUS, too.

Do we need to keep the "128 + signal" bit?  I thought that was a
normal Unix thing, and we tend to avoid saying things that are
implicitly true for every utility.

Index: timeout.c
===================================================================
RCS file: /cvs/src/usr.bin/timeout/timeout.c,v
retrieving revision 1.25
diff -u -p -r1.25 timeout.c
--- timeout.c   13 Jan 2023 06:53:04 -0000      1.25
+++ timeout.c   16 Oct 2023 15:29:02 -0000
@@ -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 */
Index: timeout.1
===================================================================
RCS file: /cvs/src/usr.bin/timeout/timeout.1,v
retrieving revision 1.7
diff -u -p -r1.7 timeout.1
--- timeout.1   12 Jan 2023 14:08:39 -0000      1.7
+++ timeout.1   16 Oct 2023 15:29:02 -0000
@@ -92,20 +92,29 @@ hours
 days
 .El
 .Sh EXIT STATUS
-If the timeout was not reached or
-.Fl p
-was set, the exit status of
-.Ar command
-is returned.
+The
+.Nm
+utility may return one of the following statuses:
 .Pp
-If the timeout was reached and
+.Bl -tag -compact
+.It 124
+The time limit expired and the
 .Fl p
-was not set, an exit status of 124 is returned.
-.Pp
-If
+flag was not set.
+.It 126
+The
 .Ar command
-exited after receiving a signal, the exit status returned is the signal number
-plus 128.
+could not be executed.
+.It 127
+The
+.Ar command
+was not found.
+.El
+.Pp
+Otherwise,
+.Nm
+returns the exit status of the
+.Ar command .
 .Sh SEE ALSO
 .Xr kill 1 ,
 .Xr signal 3

Reply via email to