--- loncom/lonnet/perl/lonnet.pm 2005/08/05 19:46:22 1.649 +++ loncom/lonnet/perl/lonnet.pm 2005/08/09 16:33:03 1.650 @@ -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 @@ sub unmark_as_readonly { 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}); } } }