X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=connect.c;h=c55a20a4aa31e7cf1bbf0dcec6b4ebccb655d850;hb=91c23e48d0666a673dd14760bb00f6d59234d9d9;hp=49251f9437183e74565c4965fa3d4451d6f29a0d;hpb=0f503d77ac9032fbfbd5f3bacafeccbcf408b31f;p=git.git diff --git a/connect.c b/connect.c index 49251f943..c55a20a4a 100644 --- a/connect.c +++ b/connect.c @@ -602,9 +602,15 @@ static void git_proxy_connect(int fd[2], char *host) #define MAX_CMD_LEN 1024 /* - * Yeah, yeah, fixme. Need to pass in the heads etc. + * This returns 0 if the transport protocol does not need fork(2), + * or a process id if it does. Once done, finish the connection + * with finish_connect() with the value returned from this function + * (it is safe to call finish_connect() with 0 to support the former + * case). + * + * Does not return a negative value on error; it just dies. */ -int git_connect(int fd[2], char *url, const char *prog) +pid_t git_connect(int fd[2], char *url, const char *prog) { char *host, *path = url; char *end; @@ -748,6 +754,9 @@ int git_connect(int fd[2], char *url, const char *prog) int finish_connect(pid_t pid) { + if (pid == 0) + return 0; + while (waitpid(pid, NULL, 0) < 0) { if (errno != EINTR) return -1;