From 97f2937034d99642d79bf081d135e8fcd8e2bf3c Mon Sep 17 00:00:00 2001 From: Daniel Dickinson Date: Tue, 29 Mar 2016 10:18:22 -0400 Subject: [PATCH] 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 --- modules/luci-base/luasrc/util.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/luci-base/luasrc/util.lua b/modules/luci-base/luasrc/util.lua index d614a6c79..896e36b45 100644 --- a/modules/luci-base/luasrc/util.lua +++ b/modules/luci-base/luasrc/util.lua @@ -640,18 +640,18 @@ function checklib(fullpathexe, wantedlib) local fs = require "nixio.fs" local haveldd = fs.access('/usr/bin/ldd') if not haveldd then - return -1 + return false end local libs = exec("/usr/bin/ldd " .. fullpathexe) if not libs then - return 0 + return false end for k, v in ipairs(split(libs)) do if v:find(wantedlib) then - return 1 + return true end end - return 0 + return false end -- -- 2.11.0