From fcfa0d639da338c470f07942da71f78fa65354a1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 25 Jan 2020 20:57:57 +0000 Subject: switch to sysseek + sysread for serving static files The "perlio" layer doesn't do read(2) syscalls over 8192 bytes at the moment, and binmode($fh, ':unix') leaks[1]. So use sysseek and sysread for now, since I can't see retaining compatibility with PerlIO::scalar being worth the trouble. [1] http://nntp.perl.org/group/perl.perl5.porters/256918 --- lib/PublicInbox/WwwStatic.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/WwwStatic.pm') diff --git a/lib/PublicInbox/WwwStatic.pm b/lib/PublicInbox/WwwStatic.pm index 60a71d8d..547b75bb 100644 --- a/lib/PublicInbox/WwwStatic.pm +++ b/lib/PublicInbox/WwwStatic.pm @@ -176,9 +176,9 @@ sub getline { my $len = $self->{len} or return; # undef, tells server we're done my $n = 8192; $n = $len if $len < $n; - seek($self->{in}, $self->{off}, SEEK_SET) or - die "seek ($self->{path}): $!"; - my $r = read($self->{in}, my $buf, $n); + sysseek($self->{in}, $self->{off}, SEEK_SET) or + die "sysseek ($self->{path}): $!"; + my $r = sysread($self->{in}, my $buf, $n); if (defined $r && $r > 0) { # success! $self->{len} = $len - $r; $self->{off} += $r; -- cgit v1.2.3-24-ge0c7