dovecot-2.1: zlib+mbox: Fixed error handling when opening nonexi...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Jan 29 00:30:30 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/dd2f85009ba0
changeset: 14029:dd2f85009ba0
user: Timo Sirainen <tss at iki.fi>
date: Sun Jan 29 00:30:23 2012 +0200
description:
zlib+mbox: Fixed error handling when opening nonexistent/directory mailbox.
diffstat:
src/plugins/zlib/zlib-plugin.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r 7a1e2cb5c13c -r dd2f85009ba0 src/plugins/zlib/zlib-plugin.c
--- a/src/plugins/zlib/zlib-plugin.c Sat Jan 28 23:58:50 2012 +0200
+++ b/src/plugins/zlib/zlib-plugin.c Sun Jan 29 00:30:23 2012 +0200
@@ -301,6 +301,7 @@
{
const struct zlib_handler *handler;
struct istream *input;
+ struct stat st;
int fd;
handler = zlib_get_zlib_handler_ext(box->name);
@@ -314,9 +315,13 @@
fd = open(box_path, O_RDONLY);
if (fd == -1) {
- mail_storage_set_critical(box->storage,
- "open(%s) failed: %m", box_path);
- return -1;
+ /* let the standard handler figure out what to do
+ with the failure */
+ return 0;
+ }
+ if (fstat(fd, &st) == 0 && S_ISDIR(st.st_mode)) {
+ (void)close(fd);
+ return 0;
}
input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE);
i_stream_set_name(input, box_path);
More information about the dovecot-cvs
mailing list