]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Fix for leaking fds with non-writable .customflags files.
authorTimo Sirainen <tss@iki.fi>
Mon, 22 Sep 2003 14:29:11 +0000 (17:29 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 22 Sep 2003 14:29:11 +0000 (17:29 +0300)
--HG--
branch : HEAD

src/lib-index/mail-custom-flags.c

index ae1753d6ccc37e91272e822fe1b282b8289b8343..e0db24db047d530fc7c5f10555c53c241d9f398f 100644 (file)
@@ -248,16 +248,14 @@ int mail_custom_flags_open_or_create(struct mail_index *index)
                                   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;