From 5419d4428c86c488a43124f85e5407d7cbae6541 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:17:47 +0200 Subject: Adding upstream version 1.11.1. Signed-off-by: Daniel Baumann --- library/Director/Core/LegacyDeploymentApi.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'library/Director/Core/LegacyDeploymentApi.php') diff --git a/library/Director/Core/LegacyDeploymentApi.php b/library/Director/Core/LegacyDeploymentApi.php index 7287c4a..0ab77e0 100644 --- a/library/Director/Core/LegacyDeploymentApi.php +++ b/library/Director/Core/LegacyDeploymentApi.php @@ -128,6 +128,10 @@ class LegacyDeploymentApi implements DeploymentApiInterface if (file_exists($path)) { if (is_link($path)) { $linkTarget = readlink($path); + if (! $linkTarget) { + throw new IcingaException('Failed to read symlink'); + } + $linkTargetDir = dirname($linkTarget); $linkTargetName = basename($linkTarget); @@ -165,7 +169,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface $this->assertDeploymentPath(); $dh = @opendir($this->deploymentPath); - if ($dh === null) { + if ($dh === false) { throw new IcingaException('Can not list contents of %s', $this->deploymentPath); } @@ -279,7 +283,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface $this->mkdir(dirname($fullPath), true); $fh = @fopen($fullPath, 'w'); - if ($fh === null) { + if ($fh === false) { throw new IcingaException('Could not open file "%s" for writing.', $fullPath); } chmod($fullPath, $this->file_mode); @@ -334,7 +338,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface protected function listDirectoryContents($path, $depth = 0) { $dh = @opendir($path); - if ($dh === null) { + if ($dh === false) { throw new IcingaException('Can not list contents of %s', $path); } -- cgit v1.2.3