Commit c2ebe8ed authored by Deucе's avatar Deucе 👌🏾
Browse files

Only remove the pid file if it has our pid in it.

parent a7f6b854
Pipeline #2973 passed with stage
in 10 minutes and 18 seconds
......@@ -1238,7 +1238,17 @@ void recycle(void* cbdata)
void cleanup(void)
{
#ifdef __unix__
unlink(pid_fname);
FILE* pf;
if ((pf = fopen(pid_fname, "r")) != NULL) {
int fpid = -1;
if (fscanf(pf, "%d", &fpid) == 1) {
fclose(pf);
if (fpid == getpid())
unlink(pid_fname);
}
else
fclose(pf);
}
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment