From b2d5843ddc739fdd1f4a7359222d04cef5f88938 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 24 Apr 2014 21:42:48 +0000 Subject: libs/sys: make sure to always return a table from arptable() when no callback is passed (#671) --- libs/sys/luasrc/sys.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libs/sys/luasrc') diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index 66285249fc..df6280dda0 100644 --- a/libs/sys/luasrc/sys.lua +++ b/libs/sys/luasrc/sys.lua @@ -233,7 +233,8 @@ net = {} -- The following fields are defined for arp entry objects: -- { "IP address", "HW address", "HW type", "Flags", "Mask", "Device" } function net.arptable(callback) - local arp, e, r, v + local arp = (not callback) and {} or nil + local e, r, v if fs.access("/proc/net/arp") then for e in io.lines("/proc/net/arp") do local r = { }, v -- cgit v1.2.3