[PATCH] connect.c: finish_connect(): allow null pid parameter

From: Franck Bui-Huu <vagabon.xyz@gmail.com>
Date: 2006-09-12 19:00:13
git_connect() can return 0 if we use git protocol for example.
Users of this function don't know and don't care if a process
had been created or not, and to avoid them to check it before
calling finish_connect() this patch allows finish_connect() to
take a null pid. And in that case return 0.

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
---

 Found it when debugging 'git archive --remote=git://...'
 command. I noticed that this command always exited with 1 as
 status.

 connect.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/connect.c b/connect.c
index 1c6429b..e6efff9 100644
--- a/connect.c
+++ b/connect.c
@@ -737,6 +737,9 @@ int git_connect(int fd[2], char *url, co
 
 int finish_connect(pid_t pid)
 {
+	if (pid == 0)
+		return 0;
+
 	while (waitpid(pid, NULL, 0) < 0) {
 		if (errno != EINTR)
 			return -1;
-- 
1.4.2
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Tue Sep 12 18:59:56 2006

This archive was generated by hypermail 2.1.8 : 2006-09-12 19:00:45 EST