From: Timo Sirainen Date: Thu, 5 Oct 2017 10:14:55 +0000 (+0300) Subject: zlib: zlib_mailbox_open_input() can't fail - remove dead code X-Git-Tag: 2.3.0.rc1~903 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f8033ffe13c1e89d734beca6d8fbb5f15dbff8b;p=thirdparty%2Fdovecot%2Fcore.git zlib: zlib_mailbox_open_input() can't fail - remove dead code --- diff --git a/src/plugins/zlib/zlib-plugin.c b/src/plugins/zlib/zlib-plugin.c index 98571a8c4a..36c9a3055d 100644 --- a/src/plugins/zlib/zlib-plugin.c +++ b/src/plugins/zlib/zlib-plugin.c @@ -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); }