[dovecot-cvs] dovecot/src/plugins/quota quota-maildir.c,1.11,1.12

cras at dovecot.org cras at dovecot.org
Mon Jul 24 04:57:17 EEST 2006


Update of /var/lib/cvs/dovecot/src/plugins/quota
In directory talvi:/tmp/cvs-serv22754

Modified Files:
	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.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- quota-maildir.c	16 Jun 2006 09:40:40 -0000	1.11
+++ quota-maildir.c	24 Jul 2006 01:57:15 -0000	1.12
@@ -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