unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch-dump.c: Fix output file being closed twice
@ 2019-07-23 20:30 Ralph Seichter
  2019-07-23 20:48 ` [PATCH] notmuch-dump.c: Fix output file being closed twice (V2) Ralph Seichter
  0 siblings, 1 reply; 5+ messages in thread
From: Ralph Seichter @ 2019-07-23 20:30 UTC (permalink / raw)
  To: notmuch

Fixed: If the output file for a dump was non-writeable, gzclose_w()
was called twice on the output file handle, resulting in SIGABRT.
---
 notmuch-dump.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/notmuch-dump.c b/notmuch-dump.c
index 505c1469..78282661 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -329,11 +329,12 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 	}
     }
 
-    if (gzclose_w (output) != Z_OK) {
+    ret = gzclose_w (output);
+    output = NULL;
+    if (ret) {
 	fprintf (stderr, "Error closing %s: %s\n", name_for_error,
 		 gzerror (output, NULL));
 	ret = EXIT_FAILURE;
-	output = NULL;
 	goto DONE;
     }
 
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-27 23:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-23 20:30 [PATCH] notmuch-dump.c: Fix output file being closed twice Ralph Seichter
2019-07-23 20:48 ` [PATCH] notmuch-dump.c: Fix output file being closed twice (V2) Ralph Seichter
2019-07-23 20:48   ` [PATCH] notmuch-dump.c: Fix output file being closed twice Ralph Seichter
2019-07-23 22:26     ` David Bremner
2019-07-24 20:56       ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).