]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
cindex: use sysread for generating fingerprint
authorEric Wong <e@80x24.org>
Wed, 25 Oct 2023 00:29:49 +0000 (00:29 +0000)
committerEric Wong <e@80x24.org>
Wed, 25 Oct 2023 07:28:50 +0000 (07:28 +0000)
We use sysseek for this file handle elsewhere (since it's passed
to `git rev-list --stdin' multiple times), and sysread ensures
we can use a larger read buffer than the tiny 8K BUFSIZ Perl +
glibc is contrained to.

This also ensures we autodie on sysread failures, since the
autodie import for `read' was missing and we don't call `read'
anywhere else in this file.

lib/PublicInbox/CodeSearchIdx.pm

index e17cba39bce914f97249bc491f36ceebf520f0f9..e31432b9a5857b3e99f29053781836d9fe101b1b 100644 (file)
@@ -57,7 +57,7 @@ use PublicInbox::Git qw(%OFMT2HEXLEN);
 use PublicInbox::Compat qw(uniqstr);
 use PublicInbox::Aspawn qw(run_await);
 use Carp ();
-use autodie qw(pipe open seek sysseek send);
+use autodie qw(pipe open sysread seek sysseek send);
 our $DO_QUIT = 15; # signal number
 our (
        $LIVE_JOBS, # integer
@@ -385,10 +385,10 @@ sub fp_start ($$$) {
 sub fp_fini { # run_git cb
        my (undef, $self, $git, $prep_repo) = @_;
        my $refs = $git->{-repo}->{refs} // die 'BUG: no {-repo}->{refs}';
-       seek($refs, 0, SEEK_SET);
+       sysseek($refs, 0, SEEK_SET);
        my $buf;
        my $dig = PublicInbox::SHA->new(256);
-       while (read($refs, $buf, 65536)) { $dig->add($buf) }
+       while (sysread($refs, $buf, 65536)) { $dig->add($buf) }
        $git->{-repo}->{fp} = $dig->hexdigest;
 }