summaryrefslogtreecommitdiff
path: root/syslogd.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2008-03-29 12:14:50 +0100
committerMichael Biebl <biebl@debian.org>2008-03-29 12:14:50 +0100
commitcb2fd7c6eb840386b2af9a1a75581d4c47281e70 (patch)
treedf229cd0216426fd0c5e146041be7b05e766238f /syslogd.c
parent9a7c5b2414911cfe8919b9f376cfc047259081b7 (diff)
downloadrsyslog-cb2fd7c6eb840386b2af9a1a75581d4c47281e70.tar.gz
Imported Upstream version 1.21.1upstream/1.21.1
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/syslogd.c b/syslogd.c
index a7e0003..3c37b99 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2824,6 +2824,7 @@ static void enqueueMsg(msg_t *pMsg)
if(pthread_cond_timedwait (fifo->notFull,
fifo->mut, &t) != 0) {
dbgprintf("enqueueMsg: cond timeout, dropping message!\n");
+ MsgDestruct(pMsg);
goto unlock;
}
}
@@ -3030,6 +3031,7 @@ static int parseRFCSyslogMsg(msg_t *pMsg, int flags)
/* MSG */
MsgSetMSG(pMsg, p2parse);
+ free(pBuf);
return 0; /* all ok */
}
/* parse a legay-formatted syslog message. This function returns
@@ -3249,13 +3251,17 @@ logmsg(int pri, msg_t *pMsg, int flags)
if(msg[0] == '1' && msg[1] == ' ') {
dbgprintf("Message has syslog-protocol format.\n");
setProtocolVersion(pMsg, 1);
- if(parseRFCSyslogMsg(pMsg, flags) == 1)
+ if(parseRFCSyslogMsg(pMsg, flags) == 1) {
+ MsgDestruct(pMsg);
return;
+ }
} else { /* we have legacy syslog */
dbgprintf("Message has legacy syslog format.\n");
setProtocolVersion(pMsg, 0);
- if(parseLegacySyslogMsg(pMsg, flags) == 1)
+ if(parseLegacySyslogMsg(pMsg, flags) == 1) {
+ MsgDestruct(pMsg);
return;
+ }
}
/* ---------------------- END PARSING ---------------- */
@@ -3628,11 +3634,11 @@ static void die(int sig)
#endif
/* now clean up the listener part */
-#ifdef SYSLOG_INET
/* Close the UNIX sockets. */
for (i = 0; i < nfunix; i++)
if (funix[i] != -1)
close(funix[i]);
+#ifdef SYSLOG_INET
/* Close the UDP inet socket. */
closeUDPListenSockets();
/* Close the TCP inet socket. */
@@ -6292,7 +6298,7 @@ int main(int argc, char **argv)
/* END core initializations */
- while ((ch = getopt(argc, argv, "46Aa:dehi:f:g:l:m:nop:qQr::s:t:u:vwx")) != EOF) {
+ while ((ch = getopt(argc, argv, "46Aa:c:dehi:f:g:l:m:nop:qQr::s:t:u:vwx")) != EOF) {
switch((char)ch) {
case '4':
family = PF_INET;
@@ -6316,6 +6322,9 @@ int main(int argc, char **argv)
else
fprintf(stderr, "rsyslogd: Out of descriptors, ignoring %s\n", optarg);
break;
+ case 'c': /* forward-compatibility: sets mode in v3+ */
+ fprintf(stderr, "-c option not yet supported, reserved for future use\n");
+ break;
case 'd': /* debug */
Debug = 1;
break;