From: Vladimír Čunát Date: Fri, 17 Aug 2018 11:21:15 +0000 (+0200) Subject: cache: relocate cache ABI version entry X-Git-Tag: v3.0.0~1^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e47133cc42dcf3ea000e6bb386c8246bbf85af9d;p=thirdparty%2Fknot-resolver.git cache: relocate cache ABI version entry ... to avoid colliding e.g. with cache.clear('.') --- diff --git a/lib/cache/api.c b/lib/cache/api.c index a3e3bb794..34b89b9d5 100644 --- a/lib/cache/api.c +++ b/lib/cache/api.c @@ -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);