]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
zlib: zlib_mailbox_open_input() can't fail - remove dead code
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 5 Oct 2017 10:14:55 +0000 (13:14 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Thu, 5 Oct 2017 11:31:38 +0000 (14:31 +0300)
src/plugins/zlib/zlib-plugin.c

index 98571a8c4aecf9cbb83836557d8607e44adc3613..36c9a3055de6fbc89b53dd91e9a7b57a38d24624 100644 (file)
@@ -253,7 +253,7 @@ zlib_permail_alloc_init(struct mailbox *box, struct mailbox_vfuncs *v)
        }
 }
 
-static int zlib_mailbox_open_input(struct mailbox *box)
+static void zlib_mailbox_open_input(struct mailbox *box)
 {
        const struct compression_handler *handler;
        struct istream *input;
@@ -262,7 +262,7 @@ static int zlib_mailbox_open_input(struct mailbox *box)
 
        handler = compression_lookup_handler_from_ext(box->name);
        if (handler == NULL || handler->create_istream == NULL)
-               return 0;
+               return;
 
        if (mail_storage_is_mailbox_file(box->storage)) {
                /* looks like a compressed single file mailbox. we should be
@@ -273,11 +273,11 @@ static int zlib_mailbox_open_input(struct mailbox *box)
                if (fd == -1) {
                        /* let the standard handler figure out what to do
                           with the failure */
-                       return 0;
+                       return;
                }
                if (fstat(fd, &st) == 0 && S_ISDIR(st.st_mode)) {
                        i_close_fd(&fd);
-                       return 0;
+                       return;
                }
                input = i_stream_create_fd_autoclose(&fd, MAX_INBUF_SIZE);
                i_stream_set_name(input, box_path);
@@ -285,7 +285,6 @@ static int zlib_mailbox_open_input(struct mailbox *box)
                i_stream_unref(&input);
                box->flags |= MAILBOX_FLAG_READONLY;
        }
-       return 0;
 }
 
 static int zlib_mailbox_open(struct mailbox *box)
@@ -294,10 +293,8 @@ static int zlib_mailbox_open(struct mailbox *box)
 
        if (box->input == NULL &&
            (box->storage->class_flags &
-            MAIL_STORAGE_CLASS_FLAG_OPEN_STREAMS) != 0) {
-               if (zlib_mailbox_open_input(box) < 0)
-                       return -1;
-       }
+            MAIL_STORAGE_CLASS_FLAG_OPEN_STREAMS) != 0)
+               zlib_mailbox_open_input(box);
 
        return zbox->super.open(box);
 }