X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmaintainer-indices;h=07b74b2c5ca7b3904bc4d2e819434df2e55f5229;hb=refs%2Fheads%2Fmaster;hp=2255aacc3948e4e0f21b9f4129c4979b6d77b8d1;hpb=5a417cf7dcb5940f947e975b1ed58da40a51254f;p=debbugs.git diff --git a/scripts/maintainer-indices b/scripts/maintainer-indices index 2255aac..07b74b2 100755 --- a/scripts/maintainer-indices +++ b/scripts/maintainer-indices @@ -102,10 +102,8 @@ if (not lockpid($config{spool_dir}.'/lock/maintainer-indices')) { # tie new maint/source maint indexes for forward and reverse for my $idx (keys %{$indexes}) { for my $fr ('','_reverse') { - tie %{$indexes->{$idx}{"tie$fr"}}, - MLDBM => $indexes->{$idx}{"index$fr"}.'-new', - O_CREAT|O_TRUNC|O_RDWR, 0644 or - die qq(Unable to tie $indexes->{$idx}{"index$fr"}-new: $!); + $indexes->{$idx}{"tie$fr"} = + create_index_file($indexes->{$idx}{"index$fr"}.'-new'); } } for my $idx (keys %{$indexes}) { @@ -129,6 +127,16 @@ for my $idx (keys %{$indexes}) { } } +sub create_index_file { + my ($idx_fn) = @_; + my $idx = {}; + tie %{$idx}, + MLDBM => $idx_fn, + O_CREAT|O_TRUNC|O_RDWR, 0644 or + die qq(Unable to tie $idx_fn: $!); + return $idx; +} + sub add_to_index { my ($fn,$forward,$reverse,$type) = @_;