From 20f8b7b0cbdab949ec4eddd3f30168d8099af96d Mon Sep 17 00:00:00 2001 From: Yun Zheng Hu Date: Tue, 12 Sep 2023 16:24:30 +0000 Subject: [PATCH] Ensure that scriptFile is a file If the scripts directory contained a directory, for example __pycache__ it would try to execute it. This ensures that we only execute files. --- open-vm-tools/scripts/common/statechange.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/open-vm-tools/scripts/common/statechange.sh b/open-vm-tools/scripts/common/statechange.sh index 40732519a..49aee2afa 100644 --- a/open-vm-tools/scripts/common/statechange.sh +++ b/open-vm-tools/scripts/common/statechange.sh @@ -88,7 +88,7 @@ RunScripts() { if [ -d "$scriptDir" ]; then for scriptFile in "$scriptDir"/*; do - if [ -x "$scriptFile" ]; then + if [ -x "$scriptFile" -a -f "$scriptFile" ]; then "$scriptFile" $powerOp exitCode=`expr $exitCode \| $?` fi