summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Seichter <abbot@monksofcool.net>2019-07-23 22:48:23 +0200
committerDavid Bremner <david@tethera.net>2019-11-27 08:00:00 -0400
commita11b2f0f2d984b7f5974aff01c9fa80718449766 (patch)
treeab69afd698d6c568b10613e1cd8ffb6b385077f6
parent8e2251484214d39bdb4872216239bd38eb7729ab (diff)
notmuch-dump.c: Fix output file being closed twice
Fixed: If the output file for a dump was non-writeable, gzclose_w() was called twice on the output file handle, resulting in SIGABRT. (cherry picked from commit 17806ecc955ce0375146ea1df51eae061a72bef8)
-rw-r--r--notmuch-dump.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/notmuch-dump.c b/notmuch-dump.c
index ef2f02df..70cdb0c2 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -329,13 +329,15 @@ notmuch_database_dump (notmuch_database_t *notmuch,
}
}
- if (gzclose_w (output) != Z_OK) {
+ ret = gzclose_w (output);
+ if (ret) {
fprintf (stderr, "Error closing %s: %s\n", name_for_error,
gzerror (output, NULL));
ret = EXIT_FAILURE;
output = NULL;
goto DONE;
- }
+ } else
+ output = NULL;
if (output_file_name) {
ret = rename (tempname, output_file_name);