luci-base: utils: Make checklib return a boolean

Using tristate is counter-intuitive and probably doesn't provide a lot
of benefit so we use a boolean and treat "don't know" as false (because
it is safer than showing options that are not actually available).

Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
This commit is contained in:
Daniel Dickinson 2016-03-29 10:18:22 -04:00
parent c5c199bc00
commit 97f2937034

View file

@ -640,18 +640,18 @@ function checklib(fullpathexe, wantedlib)
local fs = require "nixio.fs" local fs = require "nixio.fs"
local haveldd = fs.access('/usr/bin/ldd') local haveldd = fs.access('/usr/bin/ldd')
if not haveldd then if not haveldd then
return -1 return false
end end
local libs = exec("/usr/bin/ldd " .. fullpathexe) local libs = exec("/usr/bin/ldd " .. fullpathexe)
if not libs then if not libs then
return 0 return false
end end
for k, v in ipairs(split(libs)) do for k, v in ipairs(split(libs)) do
if v:find(wantedlib) then if v:find(wantedlib) then
return 1 return true
end end
end end
return 0 return false
end end
-- --