git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Don't try to reclose in command_close_bidi_pipe

From
Yuval Kogman <nothingmuch@woobling.org>
Date
Jan 30, 2009, 04:59 UTC
Message-ID
<1233291570-23295-1-git-send-email-nothingmuch@woobling.org>
Some commands require their standard input to be closed (like
git-commit-tree). This patch changes command_close_bidi_pipe so no
longer tries to close already closed handles, resulting in an error.
---
 perl/Git.pm |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/perl/Git.pm b/perl/Git.pm
index 7d7f2b1..283bba8 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -422,6 +422,7 @@ sub command_close_bidi_pipe {
 	local $?;
 	my ($pid, $in, $out, $ctx) = @_;
 	foreach my $fh ($in, $out) {
+		next unless defined(fileno($fh));
 		unless (close $fh) {
 			if ($!) {
 				carp "error closing pipe: $!";
-- 
1.6.1
Next: Tay Ray Chuan
Message 1 of 4 in “Don't try to reclose in command_close_bidi_pipe”
  1. Don't try to reclose in command_close_bidi_pipeYuval Kogman, Jan 30, 2009
  2. Tay Ray ChuanJan 30, 2009
  3. Yuval KogmanJan 30, 2009
  4. Tay Ray ChuanJan 31, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.