mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
Close FILEs before overwriting NZF file (#38332)
Based on a patch sent in by Tony Finch <dot@dotat.at>.
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,3 +1,7 @@
|
||||
4035. [bug] Close temporary and NZF FILE pointers before moving
|
||||
the former into the latter's place, as required on
|
||||
Windows. [RT #38332]
|
||||
|
||||
4034. [func] When added, negative trust anchors (NTA) are now
|
||||
saved to files (viewname.nta), in order to
|
||||
persist across restarts of the named server.
|
||||
|
@@ -9274,6 +9274,16 @@ nzf_remove(const char *nzfile, const char *viewname, const char *zonename) {
|
||||
result = isc_stdio_read(buf, 1, 1024, ifp, &n);
|
||||
}
|
||||
|
||||
/*
|
||||
* Close files before overwriting the nzfile
|
||||
* with the temporary file as it's necessary on
|
||||
* some platforms (win32).
|
||||
*/
|
||||
(void) isc_stdio_close(ifp);
|
||||
ifp = NULL;
|
||||
(void) isc_stdio_close(ofp);
|
||||
ofp = NULL;
|
||||
|
||||
/* Move temporary into place */
|
||||
CHECK(isc_file_rename(tmp, nzfile));
|
||||
} else {
|
||||
@@ -9287,9 +9297,9 @@ nzf_remove(const char *nzfile, const char *viewname, const char *zonename) {
|
||||
|
||||
cleanup:
|
||||
if (ifp != NULL)
|
||||
isc_stdio_close(ifp);
|
||||
(void) isc_stdio_close(ifp);
|
||||
if (ofp != NULL)
|
||||
isc_stdio_close(ofp);
|
||||
(void) isc_stdio_close(ofp);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user