[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 09 Aug 2005 16:33:06 -0000
albertel Tue Aug 9 12:33:06 2005 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
- when a file ws locked by two resources, the wrong resource was being unlocked (wel actaully all locks were being morphed to a lock b the resource that was doing the unlocking.)
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.649 loncom/lonnet/perl/lonnet.pm:1.650
--- loncom/lonnet/perl/lonnet.pm:1.649 Fri Aug 5 15:46:22 2005
+++ loncom/lonnet/perl/lonnet.pm Tue Aug 9 12:33:03 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.649 2005/08/05 19:46:22 albertel Exp $
+# $Id: lonnet.pm,v 1.650 2005/08/09 16:33:03 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4074,28 +4074,25 @@
my ($tmp)=keys(%current_permissions);
if ($tmp=~/^error:/) { undef(%current_permissions); }
my @readonly_files = &get_marked_as_readonly($domain,$user,$what);
- foreach my $file(@readonly_files){
- my $current_locks = $current_permissions{$file};
+ foreach my $file (@readonly_files) {
+ if (defined($file_name) && ($file_name ne $file)) { next; }
+ my $current_locks = $current_permissions{$file};
my @new_locks;
my @del_keys;
if (ref($current_locks) eq "ARRAY"){
foreach my $locker (@{$current_locks}) {
my $compare=$locker;
if (ref($locker)) { $compare=join('',@{$locker}) };
- if ($compare eq $symb_crs) {
- if (defined($file_name) && ($file_name ne $file)) {
- push(@new_locks, $what);
- }
- } else {
- push(@new_locks, $what);
+ if ($compare ne $symb_crs) {
+ push(@new_locks, $locker);
}
}
- if (@new_locks > 0) {
+ if (scalar(@new_locks) > 0) {
$current_permissions{$file} = \@new_locks;
} else {
push(@del_keys, $file);
&del('file_permissions',\@del_keys, $domain, $user);
- delete $current_permissions{$file};
+ delete($current_permissions{$file});
}
}
}