summaryrefslogtreecommitdiffstats
path: root/rfc3195d.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 /rfc3195d.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 'rfc3195d.c')
-rw-r--r--rfc3195d.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/rfc3195d.c b/rfc3195d.c
index 5a7366be..b44550d2 100644
--- a/rfc3195d.c
+++ b/rfc3195d.c
@@ -93,17 +93,20 @@ static void openlog()
strncpy(SyslogAddr.sa_data, pPathLogname,
sizeof(SyslogAddr.sa_data));
LogFile = socket(AF_UNIX, SOCK_DGRAM, 0);
- if(LogFile < 0)
+ if(LogFile < 0) {
+ char errStr[1024];
printf("error opening '%s': %s\n",
- pPathLogname, strerror(errno));
+ pPathLogname, strerror_r(errno, errStr, sizeof(errStr)));
+ }
}
if (LogFile != -1 && !connected &&
connect(LogFile, &SyslogAddr, sizeof(SyslogAddr.sa_family)+
strlen(SyslogAddr.sa_data)) != -1)
connected = 1;
- else
+ else {
printf("error connecting '%s': %s\n",
- pPathLogname, strerror(errno));
+ pPathLogname, strerror_r(errno, errStr, sizeof(errStr)));
+ }
}
@@ -157,7 +160,8 @@ void OnReceive(srAPIObj* pAPI, srSLMGObj* pSLMG)
nWritten = write(LogFile, pszRawMsg, strlen(pszRawMsg));
if(nWritten < 0) {
/* error, recover! */
- printf("error writing to domain socket: %s\r\n", strerror(errno));
+ char errStr[1024];
+ printf("error writing to domain socket: %s\r\n", strerror_r(errno, errStr, sizeof(errStr)));
closelog();
} else {
/* prepare for (potential) next write */