unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] git: return upon self->close
@ 2023-11-20  8:46 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-11-20  8:46 UTC (permalink / raw)
  To: meta

I encountered the odd lack of `return' while chasing Gcf2 bugs
on CentOS 7.x which resulted in commit 7d06b126e939
("gcf2: fix autodie usage for older Perl") and commit e618c7654794
("gcf2client: add alias for PublicInbox::Git::fail") before
realizing the lack of `return' here wasn't the culprit behind
failures on CentOS 7.x.

However, the use of a `return' here appears required in case we
actually hit the error path, since falling through and
attempting my_readline with an undefined filehandle is always a
failure.

Fixes: e97a30e7624d ("lei: fix SIGPIPE on large result sets to pager")
---
 lib/PublicInbox/Git.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 292c359a..bef524aa 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -276,7 +276,7 @@ sub cat_async_step ($$) {
 
 sub cat_async_wait ($) {
 	my ($self) = @_;
-	$self->close if !$self->{sock};
+	return $self->close if !$self->{sock};
 	my $inflight = $self->{inflight} or return;
 	while (scalar(@$inflight)) {
 		cat_async_step($self, $inflight);
@@ -332,7 +332,7 @@ sub check_async_wait ($) {
 	my ($self) = @_;
 	return cat_async_wait($self) if $self->{-bc};
 	my $ck = $self->{ck} or return;
-	$ck->close if !$ck->{sock};
+	return $ck->close if !$ck->{sock};
 	my $inflight = $ck->{inflight} or return;
 	check_async_step($ck, $inflight) while (scalar(@$inflight));
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-20  8:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20  8:46 [PATCH] git: return upon self->close Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).