Skip to content

Commit

Permalink
[backend] BSSrcServer/Registry: add locking to own/disown repo
Browse files Browse the repository at this point in the history
Oops. How did that happen?
  • Loading branch information
mlschroe committed Mar 26, 2024
1 parent 112e28c commit 2b1d065
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backend/BSSrcServer/Registry.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sub ownrepo {
# new entry... lock...
mkdir_p($registrydir) unless -d $registrydir;
my $lck;
open($lck, '>>', "$registrydir/:repos");
BSUtil::lockopen($lck, '>>', "$registrydir/:repos");
if (! -s "$registrydir/:repos") {
$registries = {};
} else {
Expand All @@ -48,7 +48,7 @@ sub ownrepo {
sub disownrepo {
my ($prp, $repo, $dodir) = @_;
my $lck;
open($lck, '>>', "$registrydir/:repos");
BSUtil::lockopen($lck, '>>', "$registrydir/:repos");
my $registries = BSUtil::retrieve("$registrydir/:repos");
die("repository '$repo' is owned by $registries->{$repo}\n") if $registries->{$repo} && $registries->{$repo} ne $prp;
delete $registries->{$repo};
Expand Down

0 comments on commit 2b1d065

Please sign in to comment.