]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: Fixed fs-sis to work again
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 10 Mar 2016 01:59:46 +0000 (14:59 +1300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 10 Mar 2016 02:02:31 +0000 (15:02 +1300)
src/lib-fs/fs-posix.c

index 566ea738d88cd5efd905e1d1ac357f74aefd1832..3e4a77923751eaf885bbb73b0ff975037090581e 100644 (file)
@@ -648,7 +648,10 @@ static int fs_posix_stat(struct fs_file *_file, struct stat *st_r)
 {
        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;