]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
zone-backup: silent static analyzer tools
authorDavid Vašek <david.vasek@nic.cz>
Tue, 24 Aug 2021 08:10:42 +0000 (10:10 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Wed, 25 Aug 2021 15:23:33 +0000 (17:23 +0200)
Creating backups in obsolete format won't ever happen.

src/knot/zone/backup.c

index 8c782dfb3168d2180d0ae80d086f86ac902b2dfa..1a8f6e7b791899a98ceee4c66bf3d9f5602cdc82 100644 (file)
@@ -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) {