summaryrefslogtreecommitdiffstats
path: root/pidfile.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-30 13:54:20 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-30 13:54:20 +0000
commit4becae174a3301eac5955f7900d3eef66728e440 (patch)
tree556f52823f113050a8952717fb32e79a2022e589 /pidfile.c
parent57cf2138522f3dacf26ea30c6f32a800def70209 (diff)
downloadrsyslog-4becae174a3301eac5955f7900d3eef66728e440.tar.gz
rsyslog-4becae174a3301eac5955f7900d3eef66728e440.tar.xz
rsyslog-4becae174a3301eac5955f7900d3eef66728e440.zip
- fixed a bug that could cause invalid string handling via strerror_r
varmojfekoj provided the patch - many thanks! - adopted varmojfekoj's patch to v3, some more sterror_r's ;)
Diffstat (limited to 'pidfile.c')
-rw-r--r--pidfile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/pidfile.c b/pidfile.c
index 9555c4a2..7ada92e7 100644
--- a/pidfile.c
+++ b/pidfile.c
@@ -23,6 +23,7 @@
#include "rsyslog.h"
+#include "syslogd.h"
/*
* Sat Aug 19 13:24:33 MET DST 1995: Martin Schulze
@@ -40,6 +41,8 @@
#include <fcntl.h>
#endif
+#include "srUtils.h"
+
/* read_pid
*
* Reads the specified pidfile and returns the read pid.
@@ -121,7 +124,7 @@ int write_pid (char *pidfile)
pid = getpid();
if (!fprintf(f,"%d\n", pid)) {
char errStr[1024];
- strerror_r(errno, errStr, sizeof(errStr));
+ rs_strerror_r(errno, errStr, sizeof(errStr));
printf("Can't write pid , %s.\n", errStr);
close(fd);
return 0;
@@ -131,7 +134,7 @@ int write_pid (char *pidfile)
#ifndef __sun
if (flock(fd, LOCK_UN) == -1) {
char errStr[1024];
- strerror_r(errno, errStr, sizeof(errStr));
+ rs_strerror_r(errno, errStr, sizeof(errStr));
printf("Can't unlock pidfile %s, %s.\n", pidfile, errStr);
close(fd);
return 0;