diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | uid.c | 21 |
2 files changed, 23 insertions, 0 deletions
@@ -9,6 +9,8 @@ a Certifying Authority we recognize?). (The `lines' figures total .c, .h, .l, and .y files under version control.) +* Ken Estes's patch to check for unreachable UIDL file due to bad NFS mount. + fetchmail-5.2.2 (Sun Dec 26 09:31:07 EST 1999), 18365 lines: * Arrange for fetchmail to restart itself quietly when the rc file is touched. * Improvements to IPv6 code from Jun-ichiro itojun Hagino <itojun@iijlab.net>. @@ -6,6 +6,8 @@ #include "config.h" +#include <sys/stat.h> +#include <errno.h> #include <stdio.h> #include <limits.h> #if defined(STDC_HEADERS) @@ -70,6 +72,7 @@ static struct idlist *scratchlist; void initialize_saved_lists(struct query *hostlist, const char *idfile) /* read file of saved IDs and attach to each host */ { + struct stat statbuf; FILE *tmpfp; struct query *ctl; @@ -77,6 +80,24 @@ void initialize_saved_lists(struct query *hostlist, const char *idfile) for (ctl = hostlist; ctl; ctl = ctl->next) ctl->skipped = ctl->oldsaved = ctl->newsaved = (struct idlist *)NULL; + errno = 0; + + /* + * Croak if the uidl directory does not exist. + * This probably means an NFS mount failed and we can't + * see a uidl file that ought to be there. + * Question: is this a portable check? It's not clear + * that all implementations of lstat() will return ENOTDIR + * rather than plain ENOENT in this case... + */ + if (lstat(idfile, &statbuf) < 0) { + if (errno == ENOTDIR) + { + report(stderr, "lstat: %s: %s\n", idfile, strerror(errno)); + exit(PS_IOERR); + } + } + /* let's get stored message UIDs from previous queries */ if ((tmpfp = fopen(idfile, "r")) != (FILE *)NULL) { |