about summary refs log tree commit homepage
path: root/lib/PublicInbox/Import.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Import.pm')
-rw-r--r--lib/PublicInbox/Import.pm6
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') ||