[dovecot-cvs] dovecot/src/plugins/quota quota-maildir.c, 1.9.2.2, 1.9.2.3
cras at dovecot.org
cras at dovecot.org
Mon Jul 24 04:57:16 EEST 2006
Update of /var/lib/cvs/dovecot/src/plugins/quota
In directory talvi:/tmp/cvs-serv19943
Modified Files:
Tag: branch_1_0
quota-maildir.c
Log Message:
Don't count "." and ".." directory sizes to quota. After rewriting
maildirsize file keep its fd open so that we can later update it. Patch by
Alexander Zagrebin
Index: quota-maildir.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-maildir.c,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -d -r1.9.2.2 -r1.9.2.3
--- quota-maildir.c 11 Jun 2006 17:34:48 -0000 1.9.2.2
+++ quota-maildir.c 24 Jul 2006 01:57:13 -0000 1.9.2.3
@@ -82,6 +82,10 @@
len = str_len(path);
while ((dp = readdir(dirp)) != NULL) {
+ if (dp->d_name[0] == '.' &&
+ (dp->d_name[1] == '\0' || dp->d_name[1] == '.'))
+ continue;
+
p = strstr(dp->d_name, ",S=");
num = (uoff_t)-1;
if (p != NULL) {
@@ -212,6 +216,8 @@
string_t *str;
int fd;
+ i_assert(root->fd == -1);
+
fd = file_dotlock_open(&dotlock_settings, path,
DOTLOCK_CREATE_FLAG_NONBLOCK, &dotlock);
if (fd == -1) {
@@ -246,11 +252,14 @@
return -1;
}
- if (file_dotlock_replace(&dotlock, 0) < 0) {
+ /* keep the fd open since we might want to update it later */
+ if (file_dotlock_replace(&dotlock,
+ DOTLOCK_REPLACE_FLAG_DONT_CLOSE_FD) < 0) {
mail_storage_set_critical(storage,
"file_dotlock_replace(%s) failed: %m", path);
return -1;
}
+ root->fd = fd;
return 0;
}
More information about the dovecot-cvs
mailing list