git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ping Yin <pkufranky@gmail.com>
To: git@vger.kernel.org
Cc: Ping Yin <pkufranky@gmail.com>
Subject: [PATCH] Fix start_command closing cmd->out/in regardless of cmd->close_out/in
Date: Mon, 19 Nov 2007 01:36:06 +0800	[thread overview]
Message-ID: <1195407366-1610-1-git-send-email-pkufranky@gmail.com> (raw)

When 'FILE *fp' is assigned to child_process.out and then start_command or
run_command is run, the standard output of the child process is expected to
be outputed to fp. However, sometimes fp is not expected to be closed since
further IO may be still performmed on fp.
---
 run-command.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/run-command.c b/run-command.c
index 476d00c..4e5f58d 100644
--- a/run-command.c
+++ b/run-command.c
@@ -115,13 +115,9 @@ int start_command(struct child_process *cmd)
 
 	if (need_in)
 		close(fdin[0]);
-	else if (cmd->in)
-		close(cmd->in);
 
 	if (need_out)
 		close(fdout[1]);
-	else if (cmd->out > 1)
-		close(cmd->out);
 
 	if (need_err)
 		close(fderr[1]);
-- 
1.5.3.5.1876.g7ba19-dirty

             reply	other threads:[~2007-11-18 17:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-18 17:36 Ping Yin [this message]
2007-11-18 18:52 ` [PATCH] Fix start_command closing cmd->out/in regardless of cmd->close_out/in Junio C Hamano
2007-11-19  7:39 ` Johannes Sixt
2007-11-19  8:46   ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2007-11-19 20:12 Ping Yin
2007-11-20 16:17 ` Johannes Sixt
2007-11-21  2:38   ` Ping Yin
2007-11-21  9:11     ` Junio C Hamano
2007-11-21 11:55       ` Ping Yin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1195407366-1610-1-git-send-email-pkufranky@gmail.com \
    --to=pkufranky@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).