luci-base: utils: Make checklib return a boolean 698/head
authorDaniel Dickinson <openwrt@daniel.thecshore.com>
Tue, 29 Mar 2016 14:18:22 +0000 (10:18 -0400)
committerDaniel Dickinson <openwrt@daniel.thecshore.com>
Fri, 8 Apr 2016 06:18:42 +0000 (02:18 -0400)
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>
modules/luci-base/luasrc/util.lua

index d614a6c799d44db2816824998b2e7c1bce859585..896e36b45f8911859fed1c2d4968f9418c301c3a 100644 (file)
@@ -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
 
 --