check for daemon pid existence before trying to connect to the control socket, and clean up stale files otherwise.
This commit is contained in:
parent
9d0e86683c
commit
4314df644e
1 changed files with 7 additions and 0 deletions
|
|
@ -718,6 +718,13 @@ bool connect_tincd(bool verbose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
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
|
#ifndef HAVE_MINGW
|
||||||
struct sockaddr_un sa;
|
struct sockaddr_un sa;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue