dovecot-2.2: fs-posix: fs_read_stream() now returns an istream t...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 24 23:55:52 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/65963be31ceb
changeset: 17834:65963be31ceb
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 25 02:55:34 2014 +0300
description:
fs-posix: fs_read_stream() now returns an istream that can live even after the fs_file is closed.

diffstat:

 src/lib-fs/fs-posix.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (18 lines):

diff -r 936435377584 -r 65963be31ceb src/lib-fs/fs-posix.c
--- a/src/lib-fs/fs-posix.c	Thu Sep 25 01:13:12 2014 +0300
+++ b/src/lib-fs/fs-posix.c	Thu Sep 25 02:55:34 2014 +0300
@@ -350,10 +350,11 @@
 
 	if (file->fd == -1 && fs_posix_open(file) < 0)
 		input = i_stream_create_error_str(errno, "%s", fs_last_error(_file->fs));
-	else
-		input = i_stream_create_fd(file->fd, max_buffer_size, FALSE);
+	else {
+		/* the stream could live even after the fs_file */
+		input = i_stream_create_fd_autoclose(&file->fd, max_buffer_size);
+	}
 	i_stream_set_name(input, _file->path);
-	i_stream_add_destroy_callback(input, fs_posix_file_close, _file);
 	return input;
 }
 


More information about the dovecot-cvs mailing list