changeset 5695:54c7e74ec973 HEAD

Fix also ACL file stat() failing with EACCES.
author Timo Sirainen <tss@iki.fi>
date Tue, 12 Jun 2007 14:54:04 +0300
parents 49412bd6b931
children b929827ddbe9
files src/plugins/acl/acl-backend-vfile.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/acl/acl-backend-vfile.c	Tue Jun 12 02:01:28 2007 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c	Tue Jun 12 14:54:04 2007 +0300
@@ -17,6 +17,9 @@
 #define ACL_ESTALE_RETRY_COUNT NFS_ESTALE_RETRY_COUNT
 #define ACL_VFILE_DEFAULT_CACHE_SECS (60*5)
 
+#define VALIDITY_MTIME_NOTFOUND 0
+#define VALIDITY_MTIME_NOACCESS -1
+
 struct acl_vfile_validity {
 	time_t last_check;
 
@@ -305,18 +308,19 @@
 		if (errno == ENOENT) {
 			if (aclobj->aclobj.backend->debug)
 				i_info("acl vfile: file %s not found", path);
+			validity->last_mtime = VALIDITY_MTIME_NOTFOUND;
 		} else if (errno == EACCES) {
 			if (aclobj->aclobj.backend->debug)
 				i_info("acl vfile: no access to file %s", path);
 
 			acl_backend_remove_all_access(&aclobj->aclobj);
+			validity->last_mtime = VALIDITY_MTIME_NOACCESS;
 		} else {
 			i_error("open(%s) failed: %m", path);
 			return -1;
 		}
 
 		validity->last_size = 0;
-		validity->last_mtime = 0;
 		validity->last_read_time = ioloop_time;
 		return 1;
 	}
@@ -445,8 +449,10 @@
 	if (stat(path, &st) < 0) {
 		if (errno == ENOENT) {
 			/* if the file used to exist, we have to re-read it */
-			return validity->last_mtime != 0;
+			return validity->last_mtime != VALIDITY_MTIME_NOTFOUND;
 		} 
+		if (errno == EACCES)
+			return validity->last_mtime != VALIDITY_MTIME_NOACCESS;
 		i_error("stat(%s) failed: %m", path);
 		return -1;
 	}