From: Tomas V.V.Cox Date: Tue, 9 Apr 2002 13:11:51 +0000 (+0000) Subject: Fix a problem when list-installed is called in a new installation X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~771 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ebb85a373898574400cf4ce2a0389024d44091f0;p=php Fix a problem when list-installed is called in a new installation --- diff --git a/pear/PEAR/Registry.php b/pear/PEAR/Registry.php index 5dd24037b1..a6c2373baa 100644 --- a/pear/PEAR/Registry.php +++ b/pear/PEAR/Registry.php @@ -215,8 +215,14 @@ class PEAR_Registry extends PEAR if (PEAR::isError($err = $this->_assertStateDir())) { return $err; } + $open_mode = 'w'; // XXX People reported problems with LOCK_SH and 'w' - $open_mode = ($mode === LOCK_SH) ? 'r' : 'w'; + if ($mode === LOCK_SH) { + if (@!is_file($this->lockfile)) { + touch($this->lockfile); + } + $open_mode = 'r'; + } $this->lock_fp = @fopen($this->lockfile, $open_mode); if (!is_resource($this->lock_fp)) { return $this->raiseError("could not create lock file: $php_errormsg");