Skip to content

Commit

Permalink
zlib: zlib_mailbox_open_input() can't fail - remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and Timo Sirainen committed Oct 5, 2017
1 parent 67445e2 commit 7f8033f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/plugins/zlib/zlib-plugin.c
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -273,19 +273,18 @@ 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);
box->input = handler->create_istream(input, TRUE);
i_stream_unref(&input);
box->flags |= MAILBOX_FLAG_READONLY;
}
return 0;
}

static int zlib_mailbox_open(struct mailbox *box)
Expand All @@ -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);
}
Expand Down

0 comments on commit 7f8033f

Please sign in to comment.