From e9d33a665ba82e6e78096e6375c47348990ff526 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20Va=C5=A1ek?= Date: Tue, 24 Aug 2021 10:10:42 +0200 Subject: [PATCH] zone-backup: silent static analyzer tools Creating backups in obsolete format won't ever happen. --- src/knot/zone/backup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/knot/zone/backup.c b/src/knot/zone/backup.c index 8c782dfb31..1a8f6e7b79 100644 --- a/src/knot/zone/backup.c +++ b/src/knot/zone/backup.c @@ -38,7 +38,7 @@ #include "knot/zone/zonefile.h" #include "libdnssec/error.h" -// Current backup format version for output. +// Current backup format version for output. Don't decrease it. #define BACKUP_VERSION BACKUP_FORMAT_2 // Starting with release 3.1.0. static void _backup_swap(zone_backup_ctx_t *ctx, void **local, void **remote) @@ -282,6 +282,10 @@ static int backup_zonefile(conf_t *conf, zone_t *zone, zone_backup_ctx_t *ctx) conf_val_t val = conf_zone_get(conf, C_ZONEFILE_SYNC, zone->name); bool can_flush = (conf_int(&val) > -1); + // The value of ctx->backup_format is always at least BACKUP_FORMAT_2 for + // the backup mode, therefore backup_zfiles_dir is always filled at this point. + assert(backup_zfiles_dir != NULL); + ret = make_dir(backup_zfiles_dir, S_IRWXU | S_IRWXG, true); if (ret == KNOT_EOK) { if (can_flush) { -- 2.47.3