[dovecot-cvs] dovecot/src/lib-index mail-custom-flags.c,1.23,1.24

cras at procontrol.fi cras at procontrol.fi
Mon Sep 22 18:29:14 EEST 2003


Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv27281

Modified Files:
	mail-custom-flags.c 
Log Message:
Fix for leaking fds with non-writable .customflags files.



Index: mail-custom-flags.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-custom-flags.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- mail-custom-flags.c	6 Aug 2003 20:15:31 -0000	1.23
+++ mail-custom-flags.c	22 Sep 2003 14:29:11 -0000	1.24
@@ -248,16 +248,14 @@
 				   CUSTOM_FLAGS_FILE_NAME, NULL);
 		fd = !readonly ? open(path, O_RDWR | O_CREAT, 0660) :
 			open(path, O_RDONLY);
-		if (fd == -1) {
-			if (errno == EACCES) {
-				fd = open(path, O_RDONLY);
-				readonly = TRUE;
-			}
-			if (errno != EACCES && errno != ENOENT &&
-			    !ENOSPACE(errno)) {
-				index_file_set_syscall_error(index, path, "open()");
-				return FALSE;
-			}
+		if (fd == -1 && errno == EACCES) {
+			fd = open(path, O_RDONLY);
+			readonly = TRUE;
+		}
+		if (fd == -1 && errno != EACCES && errno != ENOENT &&
+		    !ENOSPACE(errno)) {
+			index_file_set_syscall_error(index, path, "open()");
+			return FALSE;
 		}
 	} else {
 		path = NULL;



More information about the dovecot-cvs mailing list