[dovecot-cvs] dovecot/src/lib file-dotlock.c,1.6,1.7
cras at procontrol.fi
cras at procontrol.fi
Tue Jul 15 22:41:03 EEST 2003
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv21394
Modified Files:
file-dotlock.c
Log Message:
Minor speedup
Index: file-dotlock.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/file-dotlock.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- file-dotlock.c 5 Jul 2003 20:33:18 -0000 1.6
+++ file-dotlock.c 15 Jul 2003 18:41:01 -0000 1.7
@@ -116,22 +116,23 @@
return 1;
}
- /* see if the file we're locking is being modified */
- if (stat(lock_info->path, &st) < 0) {
- if (errno == ENOENT) {
- /* file doesn't exist. treat it as if
- it hasn't changed */
- } else {
- i_error("stat(%s) failed: %m", lock_info->path);
- return -1;
+ if (lock_info->last_change != now) {
+ if (stat(lock_info->path, &st) < 0) {
+ if (errno == ENOENT) {
+ /* file doesn't exist. treat it as if
+ it hasn't changed */
+ } else {
+ i_error("stat(%s) failed: %m", lock_info->path);
+ return -1;
+ }
+ } else if (lock_info->last_size != st.st_size ||
+ lock_info->last_ctime != st.st_ctime ||
+ lock_info->last_mtime != st.st_mtime) {
+ lock_info->last_change = now;
+ lock_info->last_size = st.st_size;
+ lock_info->last_ctime = st.st_ctime;
+ lock_info->last_mtime = st.st_mtime;
}
- } else if (lock_info->last_size != st.st_size ||
- lock_info->last_ctime != st.st_ctime ||
- lock_info->last_mtime != st.st_mtime) {
- lock_info->last_change = now;
- lock_info->last_size = st.st_size;
- lock_info->last_ctime = st.st_ctime;
- lock_info->last_mtime = st.st_mtime;
}
if (now > lock_info->last_change + (time_t)lock_info->stale_timeout) {
More information about the dovecot-cvs
mailing list