[dovecot-cvs] dovecot/src/lib-index mail-transaction-log.c, 1.120, 1.121
tss at dovecot.org
tss at dovecot.org
Wed Jan 17 18:53:29 UTC 2007
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-transaction-log.c, 1.111.2.8, 1.111.2.9
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-index-private.h, 1.69.2.4, 1.69.2.5 mail-index-sync-keywords.c, 1.9.2.2, 1.9.2.3 mail-index-sync-private.h, 1.29.2.1, 1.29.2.2 mail-index-sync-update.c, 1.96.2.7, 1.96.2.8 mail-index.c, 1.230.2.14, 1.230.2.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv32639
Modified Files:
mail-transaction-log.c
Log Message:
Don't rename() .log to .log.2, because it temporarily loses the log file.
Use unlink() + link() instead.
Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- mail-transaction-log.c 17 Jan 2007 16:17:42 -0000 1.120
+++ mail-transaction-log.c 17 Jan 2007 18:53:27 -0000 1.121
@@ -554,9 +554,19 @@
/* keep two log files */
if (rename_existing) {
+ /* rename() would be nice and easy way to do this, except then
+ there's a race condition between the rename and
+ file_dotlock_replace(). during that time the log file
+ doesn't exist, which could cause problems. */
path2 = t_strconcat(file->filepath, ".2", NULL);
- if (rename(file->filepath, path2) < 0 && errno != ENOENT) {
- mail_index_set_error(index, "rename(%s, %s) failed: %m",
+ if (unlink(path2) < 0 && errno != ENOENT) {
+ mail_index_set_error(index, "unlink(%s) failed: %m",
+ path2);
+ /* try to link() anyway */
+ }
+ if (link(file->filepath, path2) < 0 &&
+ errno != ENOENT && errno != EEXIST) {
+ mail_index_set_error(index, "link(%s, %s) failed: %m",
file->filepath, path2);
/* ignore the error. we don't care that much about the
second log file and we're going to overwrite this
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-transaction-log.c, 1.111.2.8, 1.111.2.9
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-index-private.h, 1.69.2.4, 1.69.2.5 mail-index-sync-keywords.c, 1.9.2.2, 1.9.2.3 mail-index-sync-private.h, 1.29.2.1, 1.29.2.2 mail-index-sync-update.c, 1.96.2.7, 1.96.2.8 mail-index.c, 1.230.2.14, 1.230.2.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list