Source-Changes-HG archive

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

[src/trunk]: src/bin/sh default to the original behavior for $ENV unless POSI...



details:   https://anonhg.NetBSD.org/src/rev/df28574d136d
branches:  trunk
changeset: 752243:df28574d136d
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Feb 20 23:15:17 2010 +0000

description:
default to the original behavior for $ENV unless POSIXLY_CORRECT is set.

diffstat:

 bin/sh/main.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (51 lines):

diff -r 650f0f5cb724 -r df28574d136d bin/sh/main.c
--- a/bin/sh/main.c     Sat Feb 20 22:49:22 2010 +0000
+++ b/bin/sh/main.c     Sat Feb 20 23:15:17 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.54 2010/02/17 15:57:24 christos Exp $       */
+/*     $NetBSD: main.c,v 1.55 2010/02/20 23:15:17 christos Exp $       */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.7 (Berkeley) 7/19/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.54 2010/02/17 15:57:24 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.55 2010/02/20 23:15:17 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -51,6 +51,7 @@
 #include <signal.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <locale.h>
 #include <fcntl.h>
 
@@ -80,6 +81,7 @@
 
 int rootpid;
 int rootshell;
+int posix;
 #if PROFILE
 short profile_buf[16384];
 extern int etext();
@@ -107,6 +109,7 @@
 
        setlocale(LC_ALL, "");
 
+       posix = getenv("POSIXLY_CORRECT") != NULL;
 #if PROFILE
        monitor(4, etext, profile_buf, sizeof profile_buf, 50);
 #endif
@@ -184,7 +187,7 @@
        }
 state2:
        state = 3;
-       if (iflag && getuid() == geteuid() && getgid() == getegid()) {
+       if (iflag && posix && getuid() == geteuid() && getgid() == getegid()) {
                if ((shinit = lookupvar("ENV")) != NULL && *shinit != '\0') {
                        state = 3;
                        read_profile(shinit);



Home | Main Index | Thread Index | Old Index