summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-04-20 22:52:28 +0000
committerjilles <jilles@FreeBSD.org>2010-04-20 22:52:28 +0000
commit5e21e0a12dffb180472a9da57b185707e4f5e57c (patch)
tree5d4741019ed49f5a1f4dc8852d706faa3a6c0f48 /bin
parent6f29dab87589df39c5142d3217b00a3d52622d82 (diff)
downloadFreeBSD-src-5e21e0a12dffb180472a9da57b185707e4f5e57c.zip
FreeBSD-src-5e21e0a12dffb180472a9da57b185707e4f5e57c.tar.gz
MFC r203576,r203677: sh: Don't stat() $MAIL/$MAILPATH if not interactive.
These may be NFS mounted, and we should not touch them unless we are going to do something useful with the information.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/main.c2
-rw-r--r--bin/sh/var.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c
index 6aa588f..42756e8 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -157,6 +157,8 @@ main(int argc, char *argv[])
out2str("sh: cannot determine working directory\n");
if (getpwd() != NULL)
setvar ("PWD", getpwd(), VEXPORT);
+ if (iflag)
+ chkmail(1);
if (argv[0] && argv[0][0] == '-') {
state = 1;
read_profile("/etc/profile");
diff --git a/bin/sh/var.c b/bin/sh/var.c
index 62382b2..3188b28 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -335,8 +335,13 @@ setvareq(char *s, int flags)
/*
* We could roll this to a function, to handle it as
* a regular variable function callback, but why bother?
+ *
+ * Note: this assumes iflag is not set to 1 initially.
+ * As part of init(), this is called before arguments
+ * are looked at.
*/
- if (vp == &vmpath || (vp == &vmail && ! mpathset()))
+ if ((vp == &vmpath || (vp == &vmail && ! mpathset())) &&
+ iflag == 1)
chkmail(1);
if ((vp->flags & VEXPORT) && localevar(s)) {
change_env(s, 1);
OpenPOWER on IntegriCloud