summaryrefslogtreecommitdiff
path: root/login-utils
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2006-12-07 00:26:24 +0100
committerKarel Zak <kzak@redhat.com>2006-12-07 00:26:24 +0100
commitd162fcb550a77875c8f58fda0e0a0bd91f211c99 (patch)
treebd984959acd465b3058bd805f216d29dc0c3c1a6 /login-utils
parent0b0bb92085fc7a7e7d2afe984e43161a2f4ec140 (diff)
downloadutil-linux-old-d162fcb550a77875c8f58fda0e0a0bd91f211c99.tar.gz
Imported from util-linux-2.12j tarball.
Diffstat (limited to 'login-utils')
-rw-r--r--login-utils/Makefile3
-rw-r--r--login-utils/login.c21
2 files changed, 19 insertions, 5 deletions
diff --git a/login-utils/Makefile b/login-utils/Makefile
index 6b05a168..e6e6a0d3 100644
--- a/login-utils/Makefile
+++ b/login-utils/Makefile
@@ -143,6 +143,9 @@ endif
ifeq "$(ALLOW_VCS_USE)" "yes"
LOGINFLAGS += -DCHOWNVCS
endif
+ifeq "$(DO_STAT_MAIL)" "yes"
+ LOGINFLAGS += -DDO_STAT_MAIL
+endif
login.o: login.c $(LIB)/pathnames.h $(LIB)/setproctitle.c $(LIB)/setproctitle.h
$(CC) -c $(CFLAGS) $(PAMFL) $(LOGINFLAGS) login.c
diff --git a/login-utils/login.c b/login-utils/login.c
index 3b1bfa56..66612124 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -1081,17 +1081,28 @@ Michael Riepe <michael@stud.uni-hannover.de>
}
if (!quietlog) {
- struct stat st;
- char *mail;
-
motd();
- mail = getenv("MAIL");
- if (mail && stat(mail, &st) == 0 && st.st_size != 0) {
+
+#ifdef DO_STAT_MAIL
+ /*
+ * This turns out to be a bad idea: when the mail spool
+ * is NFS mounted, and the NFS connection hangs, the
+ * login hangs, even root cannot login.
+ * Checking for mail should be done from the shell.
+ */
+ {
+ struct stat st;
+ char *mail;
+
+ mail = getenv("MAIL");
+ if (mail && stat(mail, &st) == 0 && st.st_size != 0) {
if (st.st_mtime > st.st_atime)
printf(_("You have new mail.\n"));
else
printf(_("You have mail.\n"));
+ }
}
+#endif
}
signal(SIGALRM, SIG_DFL);