From 7adb641d7cdd64a96a8ac72d71eae4f74679ea74 Mon Sep 17 00:00:00 2001 From: fritzmg Date: Thu, 21 Jun 2018 11:24:14 +0200 Subject: [PATCH] fix file lock on SunOS --- src/Symfony/Component/Filesystem/LockHandler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Filesystem/LockHandler.php b/src/Symfony/Component/Filesystem/LockHandler.php index 517b2f01e6..8290e5283a 100644 --- a/src/Symfony/Component/Filesystem/LockHandler.php +++ b/src/Symfony/Component/Filesystem/LockHandler.php @@ -75,12 +75,12 @@ class LockHandler $error = $msg; }); - if (!$this->handle = fopen($this->file, 'r')) { + if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) { if ($this->handle = fopen($this->file, 'x')) { chmod($this->file, 0444); - } elseif (!$this->handle = fopen($this->file, 'r')) { + } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) { usleep(100); // Give some time for chmod() to complete - $this->handle = fopen($this->file, 'r'); + $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r'); } } restore_error_handler();