Skip to content
Snippets Groups Projects
Commit 9d35d973 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Resolved zonedb storing for XFR (still without locking scheme).

parent 72bda12c
No related branches found
No related tags found
No related merge requests found
......@@ -1530,6 +1530,26 @@ static int ns_dump_xfr_zone_binary(knot_zone_contents_t *zone,
/*! \todo this would also need locking as well. */
if (remove(zonedb) == 0) {
/*! \todo remove CRC file correctly as well, there should be an
* API for that.
*/
const char *tmp_ext = ".crc";
char *crc_fn = malloc(strlen(zonedb) + strlen(tmp_ext) + 1);
memcpy(crc_fn, zonedb, strlen(zonedb)+1);
strcat(crc_fn, tmp_ext);
remove(crc_fn);
/* rename new crc */
char *tmp_crc = malloc(strlen(new_zonedb) + strlen(tmp_ext) + 1);
memcpy(tmp_crc, new_zonedb, strlen(new_zonedb)+1);
strcat(tmp_crc, tmp_ext);
rename(tmp_crc, crc_fn);
free(tmp_crc);
free(crc_fn);
/* rename zonedb */
if (rename(new_zonedb, zonedb) != 0) {
debug_zones("Failed to replace old zonefile %s with new"
" zone file %s.\n", zonedb, new_zonedb);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment