[dovecot-cvs] dovecot/src/lib file-dotlock.c,1.23,1.24
cras at dovecot.org
cras at dovecot.org
Mon Jan 31 20:52:26 EET 2005
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv8696/lib
Modified Files:
file-dotlock.c
Log Message:
Inode info wasn't saved when using file_dotlock_open() so
file_dotlock_delete() thought it was overridden and didn't delete it.
Index: file-dotlock.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/file-dotlock.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- file-dotlock.c 16 Jan 2005 19:18:23 -0000 1.23
+++ file-dotlock.c 31 Jan 2005 18:52:23 -0000 1.24
@@ -312,7 +312,8 @@
{
const struct dotlock_settings *set = &dotlock->settings;
const char *lock_path;
- struct lock_info lock_info;
+ struct lock_info lock_info;
+ struct stat st;
unsigned int stale_notify_threshold;
unsigned int change_secs, wait_left;
time_t now, max_wait_time, last_notify;
@@ -384,11 +385,19 @@
int old_errno = errno;
if (close(lock_info.fd) < 0)
- i_error("close(dotlock) failed: %m");
+ i_error("close(%s) failed: %m", path);
errno = old_errno;
} else {
- dotlock->path = i_strdup(path);
- dotlock->fd = lock_info.fd;
+ if (fstat(lock_info.fd, &st) < 0) {
+ i_error("fstat(%s) failed: %m", path);
+ ret = -1;
+ } else {
+ dotlock->dev = st.st_dev;
+ dotlock->ino = st.st_ino;
+
+ dotlock->path = i_strdup(path);
+ dotlock->fd = lock_info.fd;
+ }
}
if (ret == 0)
@@ -432,16 +441,6 @@
return ret;
}
- /* save the inode info after writing */
- if (fstat(dotlock->fd, &st) < 0) {
- i_error("fstat(%s) failed: %m", lock_path);
- file_dotlock_free(dotlock);
- return -1;
- }
-
- dotlock->dev = st.st_dev;
- dotlock->ino = st.st_ino;
-
fd = dotlock->fd;
dotlock->fd = -1;
More information about the dovecot-cvs
mailing list