From 35575c00e7c4e9b37f7208e568cfd9e6193bb931 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Sat, 23 Aug 2008 10:24:14 +0000 Subject: Bugfix on null match in listed peers git-svn-id: svn://svn.alpinelinux.org/acf/openssh/trunk@1405 ab2d0c66-481e-0410-8bed-d214d4d58bed --- openssh-model.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'openssh-model.lua') diff --git a/openssh-model.lua b/openssh-model.lua index 2f657f9..de1c4b5 100644 --- a/openssh-model.lua +++ b/openssh-model.lua @@ -170,8 +170,10 @@ function list_conn_peers() local f = io.popen( path .. 'netstat -lna | grep ' .. tostring(config.Port) .. ' | grep "ESTABLISHED"' ) for line in f:lines() do local peer = string.match(line, "^.-:.-:.-:.-:.-:.-:.-:(.-):.-$") - if not (netstat[peer]) then netstat[peer] = {cnt=0} end - netstat[peer]['cnt'] = (tonumber(netstat[peer]['cnt']) + 1) + if (peer) then + if not (netstat[peer]) then netstat[peer] = {cnt=0} end + netstat[peer]['cnt'] = (tonumber(netstat[peer]['cnt']) + 1) + end end f:close() -- cgit v1.2.3