]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fs-metawrap: Propagate fs_write_stream_abort() to parent always
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 12 May 2016 11:18:49 +0000 (07:18 -0400)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 12 May 2016 11:39:00 +0000 (07:39 -0400)
It needed to be done also when temp_output==NULL, because we had already
started sending it to parent, but async parent wasn't being finished.

src/lib-fs/fs-metawrap.c

index 9785ee7f43c69d6b2a3d7787b3ea3b658d95998f..5fcb49e12f437c6f621809036c87de693befe15e 100644 (file)
@@ -394,10 +394,17 @@ static int fs_metawrap_write_stream_finish(struct fs_file *_file, bool success)
                        o_stream_unref(&_file->output);
        }
        if (!success) {
-               if (file->temp_output != NULL)
-                       o_stream_destroy(&file->temp_output);
-               if (file->super_output != NULL)
+               if (file->super_output != NULL) {
+                       /* no metawrap */
+                       i_assert(file->temp_output == NULL);
+                       fs_write_stream_abort(file->super, &file->super_output);
+               } else if (file->temp_output == NULL) {
+                       /* finishing up */
+                       i_assert(file->super_output == NULL);
                        fs_write_stream_abort(file->super, &file->super_output);
+               } else {
+                       o_stream_destroy(&file->temp_output);
+               }
                return -1;
        }