diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-08-23 10:24:14 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-08-23 10:24:14 +0000 |
commit | 35575c00e7c4e9b37f7208e568cfd9e6193bb931 (patch) | |
tree | 9f8af391be2237f9e991ca066b1f75c91da19846 /openssh-model.lua | |
parent | 86885e32ea98ae7fc18c207052e2108f7cdba833 (diff) | |
download | acf-openssh-35575c00e7c4e9b37f7208e568cfd9e6193bb931.tar.bz2 acf-openssh-35575c00e7c4e9b37f7208e568cfd9e6193bb931.tar.xz |
Bugfix on null match in listed peers
git-svn-id: svn://svn.alpinelinux.org/acf/openssh/trunk@1405 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'openssh-model.lua')
-rw-r--r-- | openssh-model.lua | 6 |
1 files changed, 4 insertions, 2 deletions
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() |