aboutsummaryrefslogtreecommitdiffstats
path: root/uid.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2000-03-06 19:52:57 +0000
committerEric S. Raymond <esr@thyrsus.com>2000-03-06 19:52:57 +0000
commit582012e400e28648a602804eeea6d701f2295306 (patch)
tree4479151c2773a54535c9373f2f69fa934d1ffd43 /uid.c
parent8fafdda84fb552dbba9829308cd963d5ab78cbdd (diff)
downloadfetchmail-582012e400e28648a602804eeea6d701f2295306.tar.gz
fetchmail-582012e400e28648a602804eeea6d701f2295306.tar.bz2
fetchmail-582012e400e28648a602804eeea6d701f2295306.zip
Try to prevent .fetchids from being randomly nuked.
svn path=/trunk/; revision=2799
Diffstat (limited to 'uid.c')
-rw-r--r--uid.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/uid.c b/uid.c
index ba99fd5f..2f388a23 100644
--- a/uid.c
+++ b/uid.c
@@ -424,11 +424,24 @@ void uid_end_query(struct query *ctl)
report_complete(stdout, "\n");
}
- /* old state of mailbox may now be irrelevant */
- free_str_list(&ctl->oldsaved);
- free_str_list(&scratchlist);
- ctl->oldsaved = ctl->newsaved;
- ctl->newsaved = (struct idlist *) NULL;
+ /*
+ * Don't swap UID lists unless we've actually seen UIDLs.
+ * This is necessary in order to keep UIDL information
+ * from being heedlessly deleted later on.
+ */
+ if (ctl->have_uids)
+ {
+ /* old state of mailbox may now be irrelevant */
+ if (outlevel >= O_DEBUG)
+ report(stdout, "swapping UID lists\n");
+ free_str_list(&ctl->oldsaved);
+ free_str_list(&scratchlist);
+ ctl->oldsaved = ctl->newsaved;
+ ctl->newsaved = (struct idlist *) NULL;
+ ctl->have_uids = FALSE;
+ }
+ else if (outlevel >= O_DEBUG)
+ report(stdout, "not swapping UID lists, no UIDs seen this query\n");
}
void write_saved_lists(struct query *hostlist, const char *idfile)