[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-util.c, 1.14.2.5, 1.14.2.6
tss at dovecot.org
tss at dovecot.org
Tue May 15 13:21:01 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv29691
Modified Files:
Tag: branch_1_0
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.14.2.5
retrieving revision 1.14.2.6
diff -u -d -r1.14.2.5 -r1.14.2.6
--- maildir-util.c 25 Mar 2007 18:23:57 -0000 1.14.2.5
+++ maildir-util.c 15 May 2007 10:20:58 -0000 1.14.2.6
@@ -42,6 +42,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(STORAGE(mbox->storage),
+ "Maildir: Symlink destination doesn't exist: %s", path);
+ return -2;
+ } else {
+ mail_storage_set_critical(STORAGE(mbox->storage),
+ "maildir_file_do(%s): Filename keeps changing", path);
+ return -1;
+ }
+}
+
int maildir_file_do(struct maildir_mailbox *mbox, uint32_t uid,
maildir_file_do_func *func, void *context)
{
@@ -58,11 +75,8 @@
ret = maildir_file_do_try(mbox, uid, func, context);
}
- if (i == 10) {
- ret = -1;
- mail_storage_set_critical(STORAGE(mbox->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