luci-base/util.lua: enhance checklib function 1695/head
authorDirk Brenken <dev@brenken.org>
Thu, 22 Mar 2018 08:19:51 +0000 (09:19 +0100)
committerDirk Brenken <dev@brenken.org>
Thu, 22 Mar 2018 09:40:42 +0000 (10:40 +0100)
* enhance the checklib function in util.lua to check the 'fullpathexe'
  as well, e.g. this fixes runtime errors on the dhcp/dns template in
  environments without dnsmasq

Signed-off-by: Dirk Brenken <dev@brenken.org>
modules/luci-base/luasrc/util.lua

index 0e7334b..28c1266 100644 (file)
@@ -652,7 +652,8 @@ end
 function checklib(fullpathexe, wantedlib)
        local fs = require "nixio.fs"
        local haveldd = fs.access('/usr/bin/ldd')
-       if not haveldd then
+       local haveexe = fs.access(fullpathexe)
+       if not haveldd or not haveexe then
                return false
        end
        local libs = exec("/usr/bin/ldd " .. fullpathexe)