mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
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 17806ecc95
)
This commit is contained in:
parent
8e22514842
commit
a11b2f0f2d
1 changed files with 4 additions and 2 deletions
|
@ -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,
|
fprintf (stderr, "Error closing %s: %s\n", name_for_error,
|
||||||
gzerror (output, NULL));
|
gzerror (output, NULL));
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
output = NULL;
|
output = NULL;
|
||||||
goto DONE;
|
goto DONE;
|
||||||
}
|
} else
|
||||||
|
output = NULL;
|
||||||
|
|
||||||
if (output_file_name) {
|
if (output_file_name) {
|
||||||
ret = rename (tempname, output_file_name);
|
ret = rename (tempname, output_file_name);
|
||||||
|
|
Loading…
Reference in a new issue