]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
cache: relocate cache ABI version entry
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 17 Aug 2018 11:21:15 +0000 (13:21 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 17 Aug 2018 16:04:18 +0000 (18:04 +0200)
... to avoid colliding e.g. with cache.clear('.')

lib/cache/api.c

index a3e3bb794af16b32d95d7fa7ff232b3ea0b3f657..34b89b9d5aea86fd828f5eb39da36fb1d3716bbc 100644 (file)
@@ -73,8 +73,9 @@ static inline int cache_clear(struct kr_cache *cache)
 /** @internal Open cache db transaction and check internal data version. */
 static int assert_right_version(struct kr_cache *cache)
 {
-       /* Check cache ABI version */
-       uint8_t key_str[] = "\x00\x00V"; /* CACHE_KEY_DEF; zero-term. but we don't care */
+       /* Check cache ABI version. */
+       /* CACHE_KEY_DEF: to avoid collisions with kr_cache_match(). */
+       uint8_t key_str[4] = "VERS";
        knot_db_val_t key = { .data = key_str, .len = sizeof(key_str) };
        knot_db_val_t val = { NULL, 0 };
        int ret = cache_op(cache, read, &key, &val, 1);