luci-app-ddns: gracefully handle missing control file
authorJo-Philipp Wich <jo@mein.io>
Thu, 20 Oct 2022 08:13:38 +0000 (10:13 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 20 Oct 2022 08:13:38 +0000 (10:13 +0200)
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 <jo@mein.io>
applications/luci-app-ddns/root/usr/libexec/rpcd/luci.ddns

index 6db329c18690e4ad1dca4ec7944d0473f4415256..b2e60cb3c2d32c63f4b2dc71ee985c12c555c61f 100755 (executable)
@@ -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: (.+)$")