From: Philipp Holzer Date: Thu, 15 Aug 2019 15:55:17 +0000 (+0200) Subject: Fix Lock-Unlink X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2369ea1d500dc2ecea8e355bc2f5692a0a45cc3c;p=friendica.git Fix Lock-Unlink - Check if .sem file exists before unlinking it - Fixing https://github.com/friendica/friendica/issues/7298#issuecomment-521670482 --- diff --git a/src/Core/Lock/SemaphoreLock.php b/src/Core/Lock/SemaphoreLock.php index 75c7284a5f..0f41f9f309 100644 --- a/src/Core/Lock/SemaphoreLock.php +++ b/src/Core/Lock/SemaphoreLock.php @@ -68,8 +68,10 @@ class SemaphoreLock extends Lock if (!empty(self::$semaphore[$key])) { try { - $success = @sem_release(self::$semaphore[$key]) && - unlink(self::keyToFile($key)); + $success = @sem_release(self::$semaphore[$key]); + if (file_exists(self::keyToFile($key)) && $success) { + $success = unlink(self::keyToFile($key)); + } unset(self::$semaphore[$key]); $this->markRelease($key); } catch (\Exception $exception) {