--- loncom/lonnet/perl/lonnet.pm 2001/01/10 22:55:52 1.94 +++ loncom/lonnet/perl/lonnet.pm 2001/01/11 10:43:09 1.95 @@ -85,7 +85,7 @@ # 05/01/01 Guy Albertelli # 05/01,06/01,09/01 Gerd Kortemeyer # 09/01 Guy Albertelli -# 09/01,10/01 Gerd Kortemeyer +# 09/01,10/01,11/01 Gerd Kortemeyer package Apache::lonnet; @@ -245,18 +245,24 @@ sub appenv { $ENV{$_}=$newenv{$_}; } } keys %newenv; + + my $lockfh; + unless ($lockfh=Apache::File->new("$ENV{'user.environment'}")) { + return 'error'; + } + unless (flock($lockfh,LOCK_EX)) { + &logthis("WARNING: ". + 'Could not obtain exclusive lock in appenv: '.$!); + $lockfh->close(); + return 'error: '.$!; + } + my @oldenv; { my $fh; unless ($fh=Apache::File->new("$ENV{'user.environment'}")) { return 'error'; } - unless (flock($fh,LOCK_SH)) { - &logthis("WARNING: ". - 'Could not obtain shared lock in appenv: '.$!); - $fh->close(); - return 'error: '.$!; - } @oldenv=<$fh>; $fh->close(); } @@ -275,17 +281,13 @@ sub appenv { return 'error'; } my $newname; - unless (flock($fh,LOCK_EX)) { - &logthis("WARNING: ". - 'Could not obtain exclusive lock in appenv: '.$!); - $fh->close(); - return 'error: '.$!; - } foreach $newname (keys %newenv) { print $fh "$newname=$newenv{$newname}\n"; } $fh->close(); } + + $lockfh->close(); return 'ok'; } # ----------------------------------------------------- Delete from Environment @@ -1593,6 +1595,9 @@ sub EXT { if ($ENV{'request.course.id'}) { # ----------------------------------------------------- Cascading lookup scheme my $symbp=&symbread(); + unless ($symbp) { + &logthis('No symb for '.$ENV{'request.filename'}); + } my $mapp=(split(/\_\_\_/,$symbp))[0]; my $symbparm=$symbp.'.'.$spacequalifierrest; @@ -1615,7 +1620,6 @@ sub EXT { my $courselevelm= $ENV{'request.course.id'}.'.'.$mapparm; - # ----------------------------------------------------------- first, check user my %resourcedata=get('resourcedata', ($courselevelr,$courselevelm,$courselevel)); @@ -1636,6 +1640,7 @@ sub EXT { ""); } } + # -------------------------------------------------------- second, check course my $section=''; if ($ENV{'request.course.sec'}) { @@ -1655,8 +1660,12 @@ sub EXT { } if (($reply=~/^con_lost/) || ($reply=~/^error\:/)) { &logthis("WARNING:". - " Getting ".$reply." asking for ".$varname." from ". - $ENV{'course.'.$ENV{'request.course.id'}.$section.'.home'}. + " Getting ".$reply." asking for ".$varname." for ". + $ENV{'course.'.$ENV{'request.course.id'}.$section.'.num'}. + ' at '. + $ENV{'course.'.$ENV{'request.course.id'}.$section.'.domain'}. + ' from '. + $ENV{'course.'.$ENV{'request.course.id'}.$section.'.home'}. ""); } # ------------------------------------------------------ third, check map parms