Search
j0ke.net Open Build Service
>
Projects
>
home:netmax
:
playground
>
ocsync
> remove_signal-0.70.4.dif
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File remove_signal-0.70.4.dif of Package ocsync (Revision 2)
Currently displaying revision
2
,
show latest
--- ocsync-0.70.4/src/csync_lock.c.orig 2013-02-20 17:39:16.000000000 +0100 +++ ocsync-0.70.4/src/csync_lock.c 2013-02-26 17:47:48.574645800 +0100 @@ -29,7 +29,6 @@ #include <errno.h> #include <fcntl.h> -#include <signal.h> #include <stdio.h> #include <string.h> #include <unistd.h> @@ -123,12 +122,13 @@ static pid_t _csync_lock_read(CSYNC *ctx, const char *lockfile) { char errbuf[256] = {0}; - char buf[8] = {0}; + char buf[16] = {0}; long int tmp; ssize_t rc; int fd; pid_t pid; const _TCHAR *wlockfile; + struct stat sts; /* Read PID from existing lock */ #ifdef _WIN32 @@ -165,7 +165,11 @@ pid = (pid_t)(tmp & 0xFFFF); /* Check if process is still alive */ - if (kill(pid, 0) < 0 && errno == ESRCH) { + if (snprintf(buf, sizeof(buf), "/proc/%d", pid) < 0) { + return -1; + } + + if (stat(buf, &sts)== -1 && errno ==ENOENT) { /* Process is dead. Remove stale lock. */ if (unlink(lockfile) < 0) { strerror_r(errno, errbuf, sizeof(errbuf));