bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gawk 3.1.3 exit status glitch when /bin/sh can't be executed


From: Paul Eggert
Subject: gawk 3.1.3 exit status glitch when /bin/sh can't be executed
Date: Thu, 10 Jul 2003 17:09:38 -0700

In two places in io.c, gawk's child process exits with status 126 if
execl("/bin/sh") fails with errno != ENOENT, but in the other place
it merely exits with status 127.  This is inconsistent with common
POSIX practice.  Here is a patch.

2003-07-10  Paul Eggert  <address@hidden>

        * io.c (two_way_open): If /bin/sh cannot be executed, exit
        with status 126 consistently.

===================================================================
RCS file: io.c,v
retrieving revision 3.1.3.0
retrieving revision 3.1.3.1
diff -pu -r3.1.3.0 -r3.1.3.1
--- io.c        2003/07/04 17:50:58     3.1.3.0
+++ io.c        2003/07/11 00:05:35     3.1.3.1
@@ -1778,7 +1778,7 @@ two_way_open(const char *str, struct red
                        signal(SIGPIPE, SIG_DFL);
 
                        execl("/bin/sh", "sh", "-c", str, NULL);
-                       _exit(127);
+                       _exit(errno == ENOENT ? 127 : 126);
 
                case -1:
                        save_errno = errno;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]