Commit 4d91c80a authored by Vladimír Čunát's avatar Vladimír Čunát Committed by Petr Špaček

cache.clear('name'): correct the 'not_apex" warning

It fired also when the name didn't contain the final dot.
parent 23d5b99d
...@@ -9,6 +9,10 @@ Improvements ...@@ -9,6 +9,10 @@ Improvements
------------ ------------
- cache: handle out-of-space SIGBUS slightly better (#197) - cache: handle out-of-space SIGBUS slightly better (#197)
Bugfixes
--------
- cache.clear('name'): fix some edge cases in API (#401)
Knot Resolver 3.0.0 (2018-08-20) Knot Resolver 3.0.0 (2018-08-20)
================================ ================================
......
...@@ -180,16 +180,16 @@ cache.clear = function (name, exact_name, rr_type, chunk_size, callback, prev_st ...@@ -180,16 +180,16 @@ cache.clear = function (name, exact_name, rr_type, chunk_size, callback, prev_st
-- we assume they are advanced enough not to need the check. -- we assume they are advanced enough not to need the check.
-- The point is to avoid repeating the check in each callback iteration. -- The point is to avoid repeating the check in each callback iteration.
if callback == nil then if callback == nil then
local names = ffi.new('knot_dname_t *[1]') -- C: dname **names local apex_array = ffi.new('knot_dname_t *[1]') -- C: dname **apex_array
local ret = ffi.C.kr_cache_closest_apex(cach, dname, false, names) local ret = ffi.C.kr_cache_closest_apex(cach, dname, false, apex_array)
if ret < 0 then if ret < 0 then
error(ffi.string(ffi.C.knot_strerror(ret))) end error(ffi.string(ffi.C.knot_strerror(ret))) end
ffi.gc(names[0], ffi.C.free) ffi.gc(apex_array[0], ffi.C.free)
local apex = kres.dname2str(names[0]) if not ffi.C.knot_dname_is_equal(apex_array[0], dname) then
if apex ~= name then local apex_str = kres.dname2str(apex_array[0])
rettable.not_apex = 'to clear proofs of non-existence call ' rettable.not_apex = 'to clear proofs of non-existence call '
.. 'cache.clear(\'' .. tostring(apex) ..'\')' .. 'cache.clear(\'' .. tostring(apex_str) ..'\')'
rettable.subtree = apex rettable.subtree = apex_str
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment