[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Mon, 01 Oct 2007 23:53:46 -0000
albertel Mon Oct 1 19:53:46 2007 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
- need to test the return code on open to see if the file was opened
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.916 loncom/lonnet/perl/lonnet.pm:1.917
--- loncom/lonnet/perl/lonnet.pm:1.916 Mon Oct 1 17:52:57 2007
+++ loncom/lonnet/perl/lonnet.pm Mon Oct 1 19:53:44 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.916 2007/10/01 21:52:57 albertel Exp $
+# $Id: lonnet.pm,v 1.917 2007/10/01 23:53:44 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -320,8 +320,8 @@
my ($lonidsdir,$handle)=@_;
my @profile;
{
- open(my $idf,'+<',"$lonidsdir/$handle.id");
- if (!$idf) {
+ my $opened = open(my $idf,'+<',"$lonidsdir/$handle.id");
+ if (!$opened) {
return 0;
}
flock($idf,LOCK_SH);
@@ -362,8 +362,8 @@
my $convert;
{
- open(my $idf,'+<',"$lonidsdir/$handle.id");
- if (!$idf) {
+ my $opened = open(my $idf,'+<',"$lonidsdir/$handle.id");
+ if (!$opened) {
return;
}
flock($idf,LOCK_SH);
@@ -408,8 +408,8 @@
my $lonidsdir=$r->dir_config('lonIDsDir');
return undef if (!-e "$lonidsdir/$handle.id");
- open(my $idf,'+<',"$lonidsdir/$handle.id");
- return undef if (!$idf);
+ my $opened = open(my $idf,'+<',"$lonidsdir/$handle.id");
+ return undef if (!$opened);
flock($idf,LOCK_SH);
my %disk_env;
@@ -459,8 +459,8 @@
$env{$key}=$newenv{$key};
}
}
- open(my $env_file,'+<',$env{'user.environment'});
- if ($env_file
+ my $opened = open(my $env_file,'+<',$env{'user.environment'});
+ if ($opened
&& &timed_flock($env_file,LOCK_EX)
&&
tie(my %disk_env,'GDBM_File',$env{'user.environment'},
@@ -481,8 +481,8 @@
"Attempt to delete from environment ".$delthis);
return 'error';
}
- open(my $env_file,'+<',$env{'user.environment'});
- if ($env_file
+ my $opened = open(my $env_file,'+<',$env{'user.environment'});
+ if ($opened
&& &timed_flock($env_file,LOCK_EX)
&&
tie(my %disk_env,'GDBM_File',$env{'user.environment'},