1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#! /bin/sh -e
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch) patch $pdir -f --no-backup-if-mismatch -p1 < $0;;
-unpatch) patch $pdir -f --no-backup-if-mismatch -R -p1 < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
# DP: Apply patch from http://www.savarese.org/posix/ to improve the mail
# DP: checking code so it won't check (and possibly cause an NFS file system
# DP: mount) until MAILPATH or MAIL is given a value.
diff -ur bash-2.05b/mailcheck.c bash-2.05b.mailcheck/mailcheck.c
--- bash-2.05b/mailcheck.c 2002-01-10 14:23:15.000000000 -0500
+++ bash-2.05b.mailcheck/mailcheck.c 2003-07-28 20:58:10.000000000 -0400
@@ -69,20 +69,40 @@
static char *parse_mailpath_spec __P((char *));
-/* Returns non-zero if it is time to check mail. */
-int
-time_to_check_mail ()
-{
+intmax_t get_mailcheck(int first_check) {
char *temp;
- time_t now;
intmax_t seconds;
+ /* Terrible kluge, but expedient. Purpose is to ensure we don't allow
+ a mail check until after user init files are read. */
+ static int passed_first_check = 0;
+
+ if(first_check)
+ passed_first_check = 1;
+
+ if(!passed_first_check)
+ return -1;
temp = get_string_value ("MAILCHECK");
/* Negative number, or non-numbers (such as empty string) cause no
checking to take place. */
if (temp == 0 || legal_number (temp, &seconds) == 0 || seconds < 0)
- return (0);
+ return -1;
+
+ return seconds;
+}
+
+/* Returns non-zero if it is time to check mail. */
+int
+time_to_check_mail ()
+{
+ time_t now;
+ intmax_t seconds;
+
+ seconds = get_mailcheck(0);
+
+ if(seconds < 0)
+ return 0;
now = NOW;
/* Time to check if MAILCHECK is explicitly set to zero, or if enough
diff -ur bash-2.05b/mailcheck.h bash-2.05b.mailcheck/mailcheck.h
--- bash-2.05b/mailcheck.h 1999-08-05 07:21:16.000000000 -0400
+++ bash-2.05b.mailcheck/mailcheck.h 2003-07-28 20:58:10.000000000 -0400
@@ -29,5 +29,6 @@
extern char *make_default_mailpath __P((void));
extern void remember_mail_dates __P((void));
extern void check_mail __P((void));
+extern intmax_t get_mailcheck __P((int));
#endif /* _MAILCHECK_H */
diff -ur bash-2.05b/shell.c bash-2.05b.mailcheck/shell.c
--- bash-2.05b/shell.c 2002-07-01 11:27:11.000000000 -0400
+++ bash-2.05b.mailcheck/shell.c 2003-07-28 20:58:10.000000000 -0400
@@ -652,7 +652,8 @@
if (interactive_shell)
{
/* Set up for checking for presence of mail. */
- remember_mail_dates ();
+ if(get_mailcheck(1) >= 0)
+ remember_mail_dates ();
reset_mail_timer ();
#if defined (HISTORY)
diff -ur bash-2.05b/variables.c bash-2.05b.mailcheck/variables.c
--- bash-2.05b/variables.c 2002-06-25 09:43:33.000000000 -0400
+++ bash-2.05b.mailcheck/variables.c 2003-07-28 20:58:10.000000000 -0400
@@ -3507,7 +3507,8 @@
else
{
free_mail_files ();
- remember_mail_dates ();
+ if(get_mailcheck(0) >= 0)
+ remember_mail_dates ();
}
}
|