Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael.boelen@cisofy.com>2017-12-24 16:05:55 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2017-12-24 16:05:55 +0300
commitc487bcb277d2f20041596e047640270d2681f5c4 (patch)
tree6b22062d71082ef20e886d237edfd20e7cadc50a
parent7ae81514b41e22b6268dada909e8ab318dea6292 (diff)
\-C flag of ps is different on BSD
-rw-r--r--include/consts1
-rw-r--r--include/functions13
2 files changed, 12 insertions, 2 deletions
diff --git a/include/consts b/include/consts
index c9dcfc8e..aaccb0c1 100644
--- a/include/consts
+++ b/include/consts
@@ -208,6 +208,7 @@ unset LANG
PROFILES=""
PROFILEVALUE=""
PSBINARY="ps"
+ PSOPTIONS=""
PUPPETBINARY=""
READLINKBINARY=""
REDIS_RUNNING=0
diff --git a/include/functions b/include/functions
index d81382d6..d6eb4959 100644
--- a/include/functions
+++ b/include/functions
@@ -1253,6 +1253,7 @@
# Description : Check if a process is running
# Returns : 0 (process is running), 1 (process not running)
# RUNNING (1 = running, 0 = not running) - will be deprecated
+ # Notes : PSOPTIONS are declared globally, to prevent testing each call
################################################################################
IsRunning() {
@@ -1276,8 +1277,16 @@
if [ ! -z "${PGREPBINARY}" ]; then
FIND=$(${PGREPBINARY} ${pgrep_options} "${search}" | ${TRBINARY} '\n' ' ')
else
- PSOPTIONS=" -o args="
- if [ ${SHELL_IS_BUSYBOX} -eq 0 ]; then PSOPTIONS=" -o args= -C ${search}"; fi
+ if [ -z "${PSOPTIONS}" ]; then
+ PSOPTIONS=" -o args="
+ if [ ${SHELL_IS_BUSYBOX} -eq 0 ]; then
+ case "${OS}" in
+ "Linux")
+ PSOPTIONS=" -o args= -C ${search}"
+ ;;
+ esac
+ fi
+ fi
FIND=$(${PSBINARY} ${PSOPTIONS} | egrep "( |/)${search}" | grep -v "grep")
fi