From 2cde5ec4769f203e59413f8152008c712913bbf0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 24 Jan 2013 06:36:42 +0100 Subject: regression fix: programname was not properly handled Regression from recent refactoring - never released. --- runtime/msg.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'runtime/msg.c') diff --git a/runtime/msg.c b/runtime/msg.c index 0b9e9665..98600cdd 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -7,7 +7,7 @@ * of the "old" message code without any modifications. However, it * helps to have things at the right place one we go to the meat of it. * - * Copyright 2007-2012 Rainer Gerhards and Adiscon GmbH. + * Copyright 2007-2013 Rainer Gerhards and Adiscon GmbH. * * This file is part of the rsyslog runtime library. * @@ -2084,12 +2084,16 @@ static inline char *getStructuredData(msg_t *pM) */ uchar *getProgramName(msg_t *pM, sbool bLockMutex) { - if(pM->iLenPROGNAME == -1 && bLockMutex == LOCK_MUTEX) { - MsgLock(pM); - /* need to re-check, things may have change in between! */ - if(pM->iLenPROGNAME == -1) + if(pM->iLenPROGNAME == -1) { + if(bLockMutex == LOCK_MUTEX) { + MsgLock(pM); + /* need to re-check, things may have change in between! */ + if(pM->iLenPROGNAME == -1) + aquireProgramName(pM); + MsgUnlock(pM); + } else { aquireProgramName(pM); - MsgUnlock(pM); + } } return (pM->iLenPROGNAME < CONF_PROGNAME_BUFSIZE) ? pM->PROGNAME.szBuf : pM->PROGNAME.ptr; -- cgit v1.2.3