summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDavid Greenman <dg@FreeBSD.org>1995-08-25 02:55:49 +0000
committerDavid Greenman <dg@FreeBSD.org>1995-08-25 02:55:49 +0000
commitd2cc47c256ca5cc7ddff925cb34e4c9355a42845 (patch)
treee1ecb812ed9dc80ca2fffb5b7d87df4ffe4f1342 /bin
parenteb32ed8894e557f3060f0b3ec96a0376e425c68b (diff)
Notes
Diffstat (limited to 'bin')
-rw-r--r--bin/csh/csh.c23
-rw-r--r--bin/csh/set.c5
2 files changed, 16 insertions, 12 deletions
diff --git a/bin/csh/csh.c b/bin/csh/csh.c
index f6a24e3b9c4f..826c4276ce3f 100644
--- a/bin/csh/csh.c
+++ b/bin/csh/csh.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: csh.c,v 1.2 1994/09/24 02:53:51 davidg Exp $
+ * $Id: csh.c,v 1.3 1995/05/30 00:06:30 rgrimes Exp $
*/
#ifndef lint
@@ -248,14 +248,6 @@ main(argc, argv)
if ((tcp = getenv("TERM")) != NULL)
set(STRterm, SAVE(tcp));
- /*
- * Re-initialize path if set in environment
- */
- if ((tcp = getenv("PATH")) == NULL)
- set1(STRpath, defaultpath(), &shvhed);
- else
- importpath(SAVE(tcp));
-
set(STRshell, Strsave(STR_SHELLPATH));
doldol = putn((int) getpid()); /* For $$ */
@@ -417,6 +409,16 @@ main(argc, argv)
stderror(ERR_SYSTEM, "csh", strerror(errno));
}
}
+
+ /*
+ * Re-initialize path if set in environment
+ * importpath uses intty and intact
+ */
+ if ((tcp = getenv("PATH")) == NULL)
+ set1(STRpath, defaultpath(), &shvhed);
+ else
+ importpath(SAVE(tcp));
+
/*
* Decide whether we should play with signals or not. If we are explicitly
* told (via -i, or -) or we are a login shell (arg0 starts with -) or the
@@ -618,7 +620,8 @@ importpath(cp)
for (;;) {
if ((c = *dp) == ':' || c == 0) {
*dp = 0;
- if ((*cp != '/' || *cp == '\0') && (euid == 0 || uid == 0))
+ if (*cp != '/' && (euid == 0 || uid == 0) &&
+ (intact || intty && isatty(SHOUT)))
(void) fprintf(csherr,
"Warning: imported path contains relative components\n");
pv[i++] = Strsave(*cp ? cp : STRdot);
diff --git a/bin/csh/set.c b/bin/csh/set.c
index 7d03ac97772b..f1b5532c0f00 100644
--- a/bin/csh/set.c
+++ b/bin/csh/set.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: set.c,v 1.2 1994/09/24 02:54:16 davidg Exp $
+ * $Id: set.c,v 1.3 1995/05/30 00:06:38 rgrimes Exp $
*/
#ifndef lint
@@ -664,7 +664,8 @@ exportpath(val)
"Warning: ridiculously long PATH truncated\n");
break;
}
- if ((**val != '/' || **val == '\0') && (euid == 0 || uid == 0))
+ if (**val != '/' && (euid == 0 || uid == 0) &&
+ (intact || intty && isatty(SHOUT)))
(void) fprintf(csherr,
"Warning: exported path contains relative components.\n");
(void) Strcat(exppath, *val++);