dovecot-2.2: fs-posix: Don't close fd after successful write.

dovecot at dovecot.org dovecot at dovecot.org
Mon Mar 9 18:37:56 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/4a80d3bbf14d
changeset: 18318:4a80d3bbf14d
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 09 20:33:13 2015 +0200
description:
fs-posix: Don't close fd after successful write.
5bd6e2eee650 should have been done only on failures.

diffstat:

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

diffs (18 lines):

diff -r 2def20c622a6 -r 4a80d3bbf14d src/lib-fs/fs-posix.c
--- a/src/lib-fs/fs-posix.c	Mon Mar 09 20:26:50 2015 +0200
+++ b/src/lib-fs/fs-posix.c	Mon Mar 09 20:33:13 2015 +0200
@@ -404,10 +404,11 @@
 			fs_set_error(file->file.fs, "unlink(%s) failed: %m",
 				     file->temp_path);
 		}
-		fs_posix_file_close(&file->file);
-		i_free_and_null(file->temp_path);
-		if (ret < 0)
+		if (ret < 0) {
+			fs_posix_file_close(&file->file);
+			i_free_and_null(file->temp_path);
 			return -1;
+		}
 		break;
 	case FS_OPEN_MODE_REPLACE:
 		if (rename(file->temp_path, file->full_path) < 0) {


More information about the dovecot-cvs mailing list