Search
j0ke.net Open Build Service
>
Projects
>
home:netmax
:
tools
>
csync
> remove_signal.dif
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File remove_signal.dif of Package csync
--- csync-0.50.3/src/csync_lock.c.orig +++ csync-0.50.3/src/csync_lock.c @@ -29,7 +29,6 @@ #include <errno.h> #include <fcntl.h> -#include <signal.h> #include <stdio.h> #include <string.h> #include <unistd.h> @@ -115,8 +114,9 @@ out: static pid_t _csync_lock_read(const char *lockfile) { char errbuf[256] = {0}; - char buf[8] = {0}; + char buf[16] = {0}; int fd, pid; + struct stat sts; /* Read PID from existing lock */ #ifdef _WIN32 @@ -148,7 +148,11 @@ static pid_t _csync_lock_read(const char *lockfile) { } /* 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));