diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-12-06 17:27:37 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-12-06 17:27:37 +0100 |
commit | 42d1d27a019f25bf39c1f424cd9fb23560728c58 (patch) | |
tree | ebd6f6afb5e41bd8570ca5ca398deef518f60c8c /tools/pidfile.c | |
parent | 7df68798be96d38fcb17143daa2c3e2b093a8ba5 (diff) | |
parent | 27e0f06b17b59e5de7db94ec1d0e74369536373a (diff) | |
download | rsyslog-42d1d27a019f25bf39c1f424cd9fb23560728c58.tar.gz rsyslog-42d1d27a019f25bf39c1f424cd9fb23560728c58.tar.bz2 rsyslog-42d1d27a019f25bf39c1f424cd9fb23560728c58.zip |
Merge branch 'v7-stable-newmsglock' into master-newmsglock
Conflicts:
runtime/msg.c
runtime/queue.c
tools/syslogd.c
Diffstat (limited to 'tools/pidfile.c')
-rw-r--r-- | tools/pidfile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/pidfile.c b/tools/pidfile.c index e9601232..8298b94e 100644 --- a/tools/pidfile.c +++ b/tools/pidfile.c @@ -55,7 +55,8 @@ int read_pid (char *pidfile) if (!(f=fopen(pidfile,"r"))) return 0; - fscanf(f,"%d", &pid); + if(fscanf(f,"%d", &pid) != 1) + pid = 0; fclose(f); return pid; } @@ -113,7 +114,8 @@ int write_pid (char *pidfile) #if HAVE_FLOCK if (flock(fd, LOCK_EX|LOCK_NB) == -1) { - fscanf(f, "%d", &pid); + if(fscanf(f, "%d", &pid) != 1) + pid = 0; fclose(f); printf("Can't lock, lock is held by pid %d.\n", pid); return 0; |