From: Jo-Philipp Wich Date: Thu, 20 Oct 2022 08:13:38 +0000 (+0200) Subject: luci-app-ddns: gracefully handle missing control file X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=74283264a34083725a71a0f62de423a514efa402;p=project%2Fluci.git luci-app-ddns: gracefully handle missing control file In case `pcall()` fails, `ctrl` will contain an error message. Fixes: 3395656b9f ("luci-app-ddns: get rid of luci-lib-ipkg depdency") Signed-off-by: Jo-Philipp Wich --- diff --git a/applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns b/applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns index 6db329c186..b2e60cb3c2 100755 --- a/applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns +++ b/applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns @@ -160,8 +160,8 @@ local methods = { local res = {} local ver - local _, ctrl = pcall(io.lines, "/usr/lib/opkg/info/%s.control" % srv_name) - if ctrl then + local ok, ctrl = pcall(io.lines, "/usr/lib/opkg/info/%s.control" % srv_name) + if ok then for line in ctrl do ver = line:match("^Version: (.+)$")