summaryrefslogtreecommitdiffstats
path: root/pidfile.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-09-24 13:32:25 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-09-24 13:32:25 +0000
commitb1ca6a351c18f38b9b6fb1b18347a099ae41ef18 (patch)
tree4fa21767d72ff73c1288e1497885a85c306fa8a8 /pidfile.c
parent7fc7824b866ef7657ba52e8d7bc806d981d73811 (diff)
downloadrsyslog-b1ca6a351c18f38b9b6fb1b18347a099ae41ef18.tar.gz
rsyslog-b1ca6a351c18f38b9b6fb1b18347a099ae41ef18.tar.xz
rsyslog-b1ca6a351c18f38b9b6fb1b18347a099ae41ef18.zip
- simplified code in shouldProcessThisMessage() for debug output
- changed strerror() calls to thread-safe strerror_r() variant
Diffstat (limited to 'pidfile.c')
-rw-r--r--pidfile.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pidfile.c b/pidfile.c
index 8ab6f822..d2cd230f 100644
--- a/pidfile.c
+++ b/pidfile.c
@@ -21,6 +21,8 @@
#include "config.h"
+#include "rsyslog.h"
+
/*
* Sat Aug 19 13:24:33 MET DST 1995: Martin Schulze
* First version (v0.2) released
@@ -117,7 +119,8 @@ int write_pid (char *pidfile)
pid = getpid();
if (!fprintf(f,"%d\n", pid)) {
- printf("Can't write pid , %s.\n", strerror(errno));
+ char errStr[1024];
+ printf("Can't write pid , %s.\n", strerror_r(errno, errStr, sizeof(errStr)));
close(fd);
return 0;
}
@@ -125,7 +128,8 @@ int write_pid (char *pidfile)
#ifndef __sun
if (flock(fd, LOCK_UN) == -1) {
- printf("Can't unlock pidfile %s, %s.\n", pidfile, strerror(errno));
+ char errStr[1024];
+ printf("Can't unlock pidfile %s, %s.\n", pidfile, strerror_r(errno, errStr, sizeof(errStr)));
close(fd);
return 0;
}