From 9c3419edaf3086aa1828be9fc2998e8cf090dd8b Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 11 Jan 2008 10:22:04 +0000 Subject: use procps.pidof() git-svn-id: svn://svn.alpinelinux.org/acf/snort/trunk@553 ab2d0c66-481e-0410-8bed-d214d4d58bed --- snort-model.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'snort-model.lua') diff --git a/snort-model.lua b/snort-model.lua index 9b1300d..c52ce49 100644 --- a/snort-model.lua +++ b/snort-model.lua @@ -3,8 +3,9 @@ module (..., package.seeall) -- no initializer in model - use controller.init for that -require("posix") require("fs") +require("posix") +require("procps") local function file_info ( path ) local filedetails = posix.stat(path) @@ -38,11 +39,7 @@ end local is_running = function( process ) local statusreport = nil - local cmdoutput = {} - local cmd, error = io.popen("pidof " .. process ,r) - local cmdoutput = string.gsub(cmd:read("*a"), "%s", "") - cmd:close() - if (cmdoutput ~= "") then + if (procps.pidof(process)) then statusreport = "Yes" end return statusreport -- cgit v1.2.3