]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2006-01-12 18:57:45 by don]
authordon <>
Fri, 13 Jan 2006 02:57:45 +0000 (18:57 -0800)
committerdon <>
Fri, 13 Jan 2006 02:57:45 +0000 (18:57 -0800)
* Test for the existance of $p in Debbugs::User::get_user and return
   if the file doesn't exist; if the file does exist and we can't read
   it, die with an informative error message.

Debbugs/User.pm

index 68ae1c4566e642943652fe867843c77e3e64c96e..7591e4d113030df4cfeedc729e1b079f029b57e1 100644 (file)
@@ -45,7 +45,7 @@ use vars qw($VERSION $DEBUG %EXPORT_TAGS @EXPORT_OK @EXPORT);
 use base qw(Exporter);
 
 BEGIN {
-    ($VERSION) = q$Revision: 1.3 $ =~ /^Revision:\s+([^\s+])/;
+    ($VERSION) = q$Revision: 1.4 $ =~ /^Revision:\s+([^\s+])/;
     $DEBUG = 0 unless defined $DEBUG;
 
     @EXPORT = ();
@@ -147,7 +147,10 @@ sub get_user {
 
     my $uf;
     $user->{"filename"} = $p;
-    open($uf, "< $p") or bless $user, "Debbugs::User";
+    if (not -r $p) {
+        return bless $user, "Debbugs::User";
+    }
+    open($uf, "< $p") or die "Unable to open file $p for reading: $!";
     if ($need_lock) {
         flock($uf, LOCK_EX); 
         $user->{"locked"} = $uf;