[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-util.c, 1.25, 1.26
tss at dovecot.org
tss at dovecot.org
Tue May 15 13:21:02 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv29687
Modified Files:
maildir-util.c
Log Message:
Handle symlinks pointing to nonexisting files better.
Index: maildir-util.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-util.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- maildir-util.c 13 May 2007 17:10:52 -0000 1.25
+++ maildir-util.c 15 May 2007 10:21:00 -0000 1.26
@@ -43,6 +43,23 @@
return ret;
}
+static int do_racecheck(struct maildir_mailbox *mbox, const char *path,
+ void *context __attr_unused__)
+{
+ struct stat st;
+
+ if (lstat(path, &st) == 0 && (st.st_mode & S_IFLNK) != 0) {
+ /* most likely a symlink pointing to a non-existing file */
+ mail_storage_set_critical(&mbox->storage->storage,
+ "Maildir: Symlink destination doesn't exist: %s", path);
+ return -2;
+ } else {
+ mail_storage_set_critical(&mbox->storage->storage,
+ "maildir_file_do(%s): Filename keeps changing", path);
+ return -1;
+ }
+}
+
#undef maildir_file_do
int maildir_file_do(struct maildir_mailbox *mbox, uint32_t uid,
maildir_file_do_func *callback, void *context)
@@ -60,11 +77,8 @@
ret = maildir_file_do_try(mbox, uid, callback, context);
}
- if (i == 10) {
- ret = -1;
- mail_storage_set_critical(&mbox->storage->storage,
- "maildir_file_do(%s) racing", mbox->path);
- }
+ if (i == 10)
+ ret = maildir_file_do_try(mbox, uid, do_racecheck, context);
return ret == -2 ? 0 : ret;
}
More information about the dovecot-cvs
mailing list