]> tinc-vpn.org Git - tinc/blobdiff - src/tincctl.c
Improve subprocess behavior in tinc start command.
[tinc] / src / tincctl.c
index 12cffebc1251015f0eb387e2a2dfee8a3dffb325..f4379b7f8ebbe6dce5de0cdb42f5321e47d4599b 100644 (file)
@@ -829,9 +829,12 @@ static int cmd_start(int argc, char *argv[]) {
                nargv[nargc++] = argv[i];
 
 #ifdef HAVE_MINGW
-       execvp(c, nargv);
-       fprintf(stderr, "Error starting %s: %s\n", c, strerror(errno));
-       return 1;
+       int status = spawnvp(_P_WAIT, c, nargv);
+       if (status == -1) {
+               fprintf(stderr, "Error starting %s: %s\n", c, strerror(errno));
+               return 1;
+       }
+       return status;
 #else
        pid_t pid = fork();
        if(pid == -1) {