From: Junio C Hamano Date: Mon, 22 Jan 2007 01:10:51 GMT Subject: [PATCH] Make sure git_connect() always give two file descriptors. Message-ID: <7v3b63zx0k.fsf_-_@assigned-by-dhcp.cox.net> In-Reply-To: Earlier, git_connect() returned the same fd when the destination was remote (i.e. we used socket to communicate with it) and two separate fds when the destination was local (i.e. we used pipe(2)). This forced callers who do close() and dup() to really care which was which, and most of the existing callers got this wrong, although without much visible ill effect. Fix it to uniformly use two separate fd, so if somebody wants to close only reader side can just do close() on it without worrying about it accidentally also closing the writer side or vice versa. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- * Your patch; just checking if the above log message makes sense... connect.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/connect.c b/connect.c index 66daa11..7844888 100644 --- a/connect.c +++ b/connect.c @@ -529,7 +529,7 @@ static void git_tcp_connect(int fd[2], char *host) int sockfd = git_tcp_connect_sock(host); fd[0] = sockfd; - fd[1] = sockfd; + fd[1] = dup(sockfd); } -- 1.5.0.rc2