X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=lib%2FPublicInbox%2FDS.pm;fp=lib%2FPublicInbox%2FDS.pm;h=9cca02d7ffe99c5d32446c213c1817d53e0a7e80;hp=debb777a27e88ca675f703b396b1482138046b02;hb=3472c60fc72dfb5d1152c4015f54be1644443a20;hpb=a80fd0c8e19464f95dec5a5c2d128a1614f51ee5 diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index debb777a..9cca02d7 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -494,16 +494,15 @@ sub drop { $self->close; } -# n.b.: use ->write/->read for this buffer to allow compatibility with -# PerlIO::mmap or PerlIO::scalar if needed sub tmpio ($$$) { my ($self, $bref, $off) = @_; my $fh = tmpfile('wbuf', $self->{sock}, O_APPEND) or return drop($self, "tmpfile $!"); $fh->autoflush(1); my $len = length($$bref) - $off; - print $fh substr($$bref, $off, $len) or + my $n = syswrite($fh, $$bref, $len, $off) // return drop($self, "write ($len): $!"); + $n == $len or return drop($self, "wrote $n < $len bytes"); [ $fh, 0 ] # [1] = offset, [2] = length, not set by us }