diff options
author | Eric Wong <e@80x24.org> | 2016-04-25 09:50:00 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-04-25 09:50:26 +0000 |
commit | 51c59323fffbfbb6ebc60f58da905e88ac323da5 (patch) | |
tree | 79d878a19537e4e0ebdc06942d16a190ddaf41a5 /lib/PublicInbox/Import.pm | |
parent | 0d02fc0c2441266e5cc64fc92063fcb04bd13bbf (diff) | |
download | public-inbox-51c59323fffbfbb6ebc60f58da905e88ac323da5.tar.gz |
The read could fail entirely and leave $lf undefined.
Diffstat (limited to 'lib/PublicInbox/Import.pm')
-rw-r--r-- | lib/PublicInbox/Import.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 7073c3d9..8a40fb53 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -93,14 +93,16 @@ sub remove { my $left = $1; my $offset = 0; my $buf = ''; + my $n; while ($left > 0) { - my $n = read($r, $buf, $left, $offset); + $n = read($r, $buf, $left, $offset); defined($n) or die "read cat-blob failed: $!"; $n == 0 and die 'fast-export (cat-blob) died'; $left -= $n; $offset += $n; } - read($r, my $lf, 1); + $n = read($r, my $lf, 1); + defined($n) or die "read final byte of cat-blob failed: $!"; die "bad read on final byte: <$lf>" if $lf ne "\n"; my $cur = Email::MIME->new($buf); if ($cur->header('Subject') ne $mime->header('Subject') || |