aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1999-12-27 08:07:10 +0000
committerEric S. Raymond <esr@thyrsus.com>1999-12-27 08:07:10 +0000
commitfd1ddc79d9205c3101529654fe73a3bd346f2358 (patch)
tree563174b92239f14bc9c6d758041a3be314ffae5c
parent4c5f1ccc3f27ce8ea51e9e0a0387a82e131a78ba (diff)
downloadfetchmail-fd1ddc79d9205c3101529654fe73a3bd346f2358.tar.gz
fetchmail-fd1ddc79d9205c3101529654fe73a3bd346f2358.tar.bz2
fetchmail-fd1ddc79d9205c3101529654fe73a3bd346f2358.zip
Minor optimizations from Federico.
svn path=/trunk/; revision=2690
-rw-r--r--NEWS2
-rw-r--r--uid.c21
2 files changed, 23 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 719a60aa..d9b25762 100644
--- a/NEWS
+++ b/NEWS
@@ -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>.
diff --git a/uid.c b/uid.c
index 9a132606..8b956fc1 100644
--- a/uid.c
+++ b/uid.c
@@ -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)
{