Code

t/README: start testing porcelainish
[git.git] / connect.c
index 52d709e58d53f053ec00bfb9f31501684cbaf0e5..cb4656d79d3bd2d22f719724f4c393b6ac70f633 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -8,6 +8,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#include <signal.h>
 
 static char *server_capabilities = NULL;
 
@@ -329,7 +330,7 @@ static int git_tcp_connect_sock(char *host)
 {
        int sockfd = -1;
        char *colon, *end;
-       char *port = STR(DEFAULT_GIT_PORT);
+       const char *port = STR(DEFAULT_GIT_PORT);
        struct addrinfo hints, *ai0, *ai;
        int gai;
 
@@ -450,8 +451,7 @@ static int git_tcp_connect_sock(char *host)
 #endif /* NO_IPV6 */
 
 
-static void git_tcp_connect(int fd[2],
-                           const char *prog, char *host, char *path)
+static void git_tcp_connect(int fd[2], char *host)
 {
        int sockfd = git_tcp_connect_sock(host);
 
@@ -521,10 +521,9 @@ static int git_use_proxy(const char *host)
        return (git_proxy_command && *git_proxy_command);
 }
 
-static void git_proxy_connect(int fd[2],
-                             const char *prog, char *host, char *path)
+static void git_proxy_connect(int fd[2], char *host)
 {
-       char *port = STR(DEFAULT_GIT_PORT);
+       const char *port = STR(DEFAULT_GIT_PORT);
        char *colon, *end;
        int pipefd[2][2];
        pid_t pid;
@@ -581,6 +580,11 @@ int git_connect(int fd[2], char *url, const char *prog)
        enum protocol protocol = PROTO_LOCAL;
        int free_path = 0;
 
+       /* Without this we cannot rely on waitpid() to tell
+        * what happened to our children.
+        */
+       signal(SIGCHLD, SIG_DFL);
+
        host = strstr(url, "://");
        if(host) {
                *host = '\0';
@@ -637,9 +641,9 @@ int git_connect(int fd[2], char *url, const char *prog)
                 */
                char *target_host = strdup(host);
                if (git_use_proxy(host))
-                       git_proxy_connect(fd, prog, host, path);
+                       git_proxy_connect(fd, host);
                else
-                       git_tcp_connect(fd, prog, host, path);
+                       git_tcp_connect(fd, host);
                /*
                 * Separate original protocol components prog and path
                 * from extended components with a NUL byte.