[dovecot-cvs] dovecot/src/lib file-dotlock.c,1.4,1.5
cras at procontrol.fi
cras at procontrol.fi
Thu Apr 17 18:20:50 EEST 2003
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv1397
Modified Files:
file-dotlock.c
Log Message:
We got dotlock's mtime before modifying it, which caused problems sometimes.
Index: file-dotlock.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/file-dotlock.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- file-dotlock.c 15 Apr 2003 19:00:14 -0000 1.4
+++ file-dotlock.c 17 Apr 2003 14:20:47 -0000 1.5
@@ -147,17 +147,6 @@
if (fd == -1)
return -1;
- /* got it, save the inode info */
- if (fstat(fd, &st) < 0) {
- i_error("fstat(%s) failed: %m", lock_path);
- (void)close(fd);
- return -1;
- }
-
- dotlock_r->dev = st.st_dev;
- dotlock_r->ino = st.st_ino;
- dotlock_r->mtime = st.st_mtime;
-
/* write our pid and host, if possible */
str = t_strdup_printf("%s:%s", my_pid, my_hostname);
if (write_full(fd, str, strlen(str)) < 0) {
@@ -169,6 +158,17 @@
return -1;
}
}
+
+ /* save the inode info after writing */
+ if (fstat(fd, &st) < 0) {
+ i_error("fstat(%s) failed: %m", lock_path);
+ (void)close(fd);
+ return -1;
+ }
+
+ dotlock_r->dev = st.st_dev;
+ dotlock_r->ino = st.st_ino;
+ dotlock_r->mtime = st.st_mtime;
if (close(fd) < 0) {
i_error("close(%s) failed: %m", lock_path);
More information about the dovecot-cvs
mailing list