From 74283264a34083725a71a0f62de423a514efa402 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 20 Oct 2022 10:13:38 +0200 Subject: [PATCH] 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 --- applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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: (.+)$") -- 2.30.2