From b1ca6a351c18f38b9b6fb1b18347a099ae41ef18 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 24 Sep 2007 13:32:25 +0000 Subject: - simplified code in shouldProcessThisMessage() for debug output - changed strerror() calls to thread-safe strerror_r() variant --- pidfile.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pidfile.c') 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; } -- cgit