summaryrefslogtreecommitdiffstats
path: root/bin/sh/var.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-02-06 22:57:24 +0000
committerjilles <jilles@FreeBSD.org>2010-02-06 22:57:24 +0000
commit9c81a24436f4b19434a1d75bf5b592a13ad156c2 (patch)
tree9e9308576f99844cd3f9846a35a80d74607e5c0a /bin/sh/var.c
parent6d3ec806895e807566f3ba15226c51fc15c5e7a5 (diff)
downloadFreeBSD-src-9c81a24436f4b19434a1d75bf5b592a13ad156c2.zip
FreeBSD-src-9c81a24436f4b19434a1d75bf5b592a13ad156c2.tar.gz
sh: Do not stat() $MAIL/$MAILPATH in non-interactive shells.
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/sh/var.c')
-rw-r--r--bin/sh/var.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c
index 0a80604..d46e2c3 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -337,8 +337,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