From 011a316f949b4323554e8eecbb2a1f7622d6f968 Mon Sep 17 00:00:00 2001 From: deajan Date: Sun, 28 May 2017 20:17:38 +0200 Subject: [PATCH] Added pid test in KillChilds --- dev/ofunctions.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index 553de0d..8af7448 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -3,7 +3,7 @@ #### OFUNCTIONS MINI SUBSET #### _OFUNCTIONS_VERSION=2.1.4-dev -_OFUNCTIONS_BUILD=2017052801 +_OFUNCTIONS_BUILD=2017052802 #### _OFUNCTIONS_BOOTSTRAP SUBSET #### _OFUNCTIONS_BOOTSTRAP=true #### _OFUNCTIONS_BOOTSTRAP SUBSET END #### @@ -317,6 +317,11 @@ function KillChilds { local pid="${1}" # Parent pid to kill childs local self="${2:-false}" # Should parent be killed too ? + if [ $(IsNumeric "$pid") -eq 0 ] || [ "$pid" == "" ]; then + Logger "Bogus pid given [$pid]." "CRITICAL" + return 1 + fi + # Warning: pgrep does not exist in cygwin, have this checked in CheckEnvironment if children="$(pgrep -P "$pid")"; then if [[ "$pid" == *"$children"* ]]; then