From c1cc6449c55b5d7dc451ac0db627339612c7bb87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sun, 29 Jun 2014 17:27:01 +0200 Subject: [PATCH] check whether ManiaControl.sh exists before trying to restart --- application/core/ManiaControl.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index d875f0d0..5367c530 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -251,7 +251,12 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { $this->log("Can't restart ManiaControl because the function 'exec' is disabled!"); return; } - $command = 'sh ' . escapeshellarg(ManiaControlDir . 'ManiaControl.sh') . ' > /dev/null &'; + $fileName = ManiaControlDir . 'ManiaControl.sh'; + if (!is_readable($fileName)) { + $this->log("Can't restart ManiaControl because the file 'ManiaControl.sh' doesn't exist or isn't readable!"); + return; + } + $command = 'sh ' . escapeshellarg($fileName) . ' > /dev/null &'; exec($command); } else { // Windows