}
fclose(f);
+ if ((pid == 0) || (kill(pid, 0) && (errno == ESRCH))) {
+ fprintf(stderr, "Could not find tincd running at pid %d\n", pid);
+ /* clean up the stale socket and pid file */
+ unlink(pidfilename);
+ unlink(unixsocketname);
+ return false;
+ }
#ifndef HAVE_MINGW
struct sockaddr_un sa;
return 1;
}
- if(!connect_tincd(true) && !pid)
+ if(!connect_tincd(true) || !pid)
return 1;
printf("%d\n", pid);