Merge branch 'es/blame-L-twice'
[gitweb.git] / compat / mingw.c
index dae30a081c03b28aa7b89489ffd01b6ce24e8070..22ee9ef1cfb388fdcb7a2686653a6b10359bca59 100644 (file)
@@ -841,8 +841,8 @@ struct pinfo_t {
        struct pinfo_t *next;
        pid_t pid;
        HANDLE proc;
-} pinfo_t;
-struct pinfo_t *pinfo = NULL;
+};
+static struct pinfo_t *pinfo = NULL;
 CRITICAL_SECTION pinfo_cs;
 
 static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **env,
@@ -1086,6 +1086,12 @@ int mingw_kill(pid_t pid, int sig)
                errno = err_win_to_posix(GetLastError());
                CloseHandle(h);
                return -1;
+       } else if (pid > 0 && sig == 0) {
+               HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
+               if (h) {
+                       CloseHandle(h);
+                       return 0;
+               }
        }
 
        errno = EINVAL;
@@ -1253,7 +1259,7 @@ static int WSAAPI getaddrinfo_stub(const char *node, const char *service,
        else
                sin->sin_addr.s_addr = INADDR_LOOPBACK;
        ai->ai_addr = (struct sockaddr *)sin;
-       ai->ai_next = 0;
+       ai->ai_next = NULL;
        return 0;
 }