From 19b791f4894efcb6e545a6b51c8147298363358f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 17 Oct 2023 23:37:52 +0000 Subject: use read_all in more places to improve safety `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. --- lib/PublicInbox/WWW.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/WWW.pm') diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 9919f975..86fd7e22 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -587,9 +587,9 @@ sub stylesheets_prepare ($$) { next; }; my $ctime = 0; - my $local = do { local $/; <$fh> }; + my $local = read_all($fh, -s $fh); if ($local =~ /\S/) { - $ctime = sprintf('%x',(stat($fh))[10]); + $ctime = sprintf('%x',(stat(_))[10]); $local = $mini->($local); } -- cgit v1.2.3-24-ge0c7