diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-04-24 21:42:48 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-04-24 21:42:48 +0000 |
commit | b2d5843ddc739fdd1f4a7359222d04cef5f88938 (patch) | |
tree | 786115c3b51e42757d09b0b2ceea86ef0577f15f | |
parent | 0b5861d6bfb468c840ccda78f532ee2af8c34ebc (diff) |
libs/sys: make sure to always return a table from arptable() when no callback is passed (#671)
-rw-r--r-- | libs/sys/luasrc/sys.lua | 3 |
1 files changed, 2 insertions, 1 deletions
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 |