aboutsummaryrefslogtreecommitdiffstats
path: root/uid.c
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 /uid.c
parent4c5f1ccc3f27ce8ea51e9e0a0387a82e131a78ba (diff)
downloadfetchmail-fd1ddc79d9205c3101529654fe73a3bd346f2358.tar.gz
fetchmail-fd1ddc79d9205c3101529654fe73a3bd346f2358.tar.bz2
fetchmail-fd1ddc79d9205c3101529654fe73a3bd346f2358.zip
Minor optimizations from Federico.
svn path=/trunk/; revision=2690
Diffstat (limited to 'uid.c')
-rw-r--r--uid.c21
1 files changed, 21 insertions, 0 deletions
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)
{