From ebb85a373898574400cf4ce2a0389024d44091f0 Mon Sep 17 00:00:00 2001 From: "Tomas V.V.Cox" Date: Tue, 9 Apr 2002 13:11:51 +0000 Subject: [PATCH] Fix a problem when list-installed is called in a new installation --- pear/PEAR/Registry.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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"); -- 2.50.1