changeset 19922:377ec37208e5

lib-fs: Fixed fs-sis to work again
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 10 Mar 2016 14:59:46 +1300
parents 7b75d494429c
children 81df79443d12
files src/lib-fs/fs-posix.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-fs/fs-posix.c	Fri Mar 04 16:40:23 2016 +0200
+++ b/src/lib-fs/fs-posix.c	Thu Mar 10 14:59:46 2016 +1300
@@ -648,7 +648,10 @@
 {
 	struct posix_fs_file *file = (struct posix_fs_file *)_file;
 
-	if (file->fd != -1) {
+	/* in case output != NULL it means that we're still writing to the file
+	   and fs_stat() shouldn't stat the unfinished file. this is done by
+	   fs-sis after fs_copy(). */
+	if (file->fd != -1 && _file->output == NULL) {
 		if (fstat(file->fd, st_r) < 0) {
 			fs_set_error(_file->fs, "fstat(%s) failed: %m", file->full_path);
 			return -1;