exit 126 means "utility was found but could not be invoked".
exit 1-125 means some other error in env(1)

So change 2 places to return an exit code of 125 instead.

Index: env.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/env/env.c,v
retrieving revision 1.14
diff -u -r1.14 env.c
--- env.c       27 Oct 2009 23:59:37 -0000      1.14
+++ env.c       22 Jul 2010 20:42:41 -0000
@@ -54,7 +54,7 @@
                case '-':                       /* obsolete */
                case 'i':
                        if ((environ = calloc(1, sizeof(char *))) == NULL)
-                               err(126, "calloc");
+                               err(125, "calloc");
                        break;
                default:
                        usage();
@@ -65,8 +65,7 @@
        for (; *argv && (p = strchr(*argv, '=')); ++argv) {
                *p++ = '\0';
                if (setenv(*argv, p, 1) == -1) {
-                       /* reuse 126, it matches the problem most */
-                       exit(126);
+                       err(125, "setenv");
                }
        }

Reply via email to