luci-app-openvpn: properly parse low PIDs

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2018-04-13 14:45:02 +02:00
parent d4886818ce
commit 9f327a3d02

View file

@ -28,7 +28,7 @@ uci:foreach( "openvpn_recipes", "openvpn_recipe",
function s.getPID(section) -- Universal function which returns valid pid # or nil
local pid = sys.exec("%s | grep -w '[o]penvpn(%s)'" % { psstring, section })
if pid and #pid > 0 then
return tonumber(pid:match("^%d+"))
return tonumber(pid:match("^%s*(%d+)"))
else
return nil
end