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. --- script/public-inbox-edit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'script/public-inbox-edit') diff --git a/script/public-inbox-edit b/script/public-inbox-edit index 1fb6f32b..77028817 100755 --- a/script/public-inbox-edit +++ b/script/public-inbox-edit @@ -15,6 +15,7 @@ PublicInbox::Admin::check_require('-index'); use PublicInbox::Eml; use PublicInbox::InboxWritable qw(eml_from_path); use PublicInbox::Import; +use PublicInbox::Git qw(read_all); my $help = <<'EOF'; usage: public-inbox-edit -m MESSAGE-ID [--all] [INBOX_DIRS] @@ -184,8 +185,7 @@ retry_edit: # rename/relink $edit_fn open my $new_fh, '<', $edit_fn or die "can't read edited file ($edit_fn): $!\n"; - defined(my $new_raw = do { local $/; <$new_fh> }) or die - "read $edit_fn: $!\n"; + my $new_raw = read_all($new_fh); if (!$opt->{raw}) { PublicInbox::Eml::strip_from($new_raw); -- cgit v1.2.3-24-ge0c7