From: Tomas V.V.Cox Date: Mon, 1 Apr 2002 16:10:39 +0000 (+0000) Subject: People reported problems with flock(LOCK_SH) and fopen('w') X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~931 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b68037886949d7878d6e33f96d62cb2320e11ec;p=php People reported problems with flock(LOCK_SH) and fopen('w') --- diff --git a/pear/PEAR/Registry.php b/pear/PEAR/Registry.php index c09e3abddb..fa149ee74d 100644 --- a/pear/PEAR/Registry.php +++ b/pear/PEAR/Registry.php @@ -215,7 +215,9 @@ class PEAR_Registry extends PEAR if (PEAR::isError($err = $this->_assertStateDir())) { return $err; } - $this->lock_fp = @fopen($this->lockfile, 'w'); + // XXX People reported problems with LOCK_SH and 'w' + $open_mode = ($mode === LOCK_SH) ? 'r' : 'w'; + $this->lock_fp = @fopen($this->lockfile, $open_mode); if (!is_resource($this->lock_fp)) { return $this->raiseError("could not create lock file: $php_errormsg"); }