diff options
author | Eric Wong <e@80x24.org> | 2023-10-17 23:37:52 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-18 20:50:24 +0000 |
commit | 19b791f4894efcb6e545a6b51c8147298363358f (patch) | |
tree | 16a806fcb0c8fdaef242a2d268a8b1416809b46f /lib/PublicInbox/LeiMailSync.pm | |
parent | 35b0f7aa00a24f5d89b1b941ec644327ba074c99 (diff) | |
download | public-inbox-19b791f4894efcb6e545a6b51c8147298363358f.tar.gz |
`readline' ops may not detect errors on partial reads. This saves us some code to reduce cognitive overhead for readers. We'll also support reusing a destination buffers so it can work more nicely with existing code.
Diffstat (limited to 'lib/PublicInbox/LeiMailSync.pm')
-rw-r--r-- | lib/PublicInbox/LeiMailSync.pm | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/PublicInbox/LeiMailSync.pm b/lib/PublicInbox/LeiMailSync.pm index 415459d5..74ef1362 100644 --- a/lib/PublicInbox/LeiMailSync.pm +++ b/lib/PublicInbox/LeiMailSync.pm @@ -10,7 +10,7 @@ use PublicInbox::Compat qw(uniqstr); use DBI qw(:sql_types); # SQL_BLOB use PublicInbox::ContentHash qw(git_sha); use Carp (); -use PublicInbox::Git qw(%HEXLEN2SHA); +use PublicInbox::Git qw(%HEXLEN2SHA read_all); sub dbh_new { my ($self) = @_; @@ -456,8 +456,7 @@ WHERE b.oidbin = ? open my $fh, '<', $f or next; # some (buggy) Maildir writers are non-atomic: next unless -s $fh; - local $/; - my $raw = <$fh>; + my $raw = read_all($fh, -s _); if ($vrfy) { my $sha = $HEXLEN2SHA{length($oidhex)}; my $got = git_sha($sha, \$raw)->hexdigest; |