diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-10-17 13:04:59 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-10-17 13:04:59 +0200 |
commit | f06862eff598b0355fa5e21424906e48dc7581da (patch) | |
tree | 5d399fbcbf450605a3d321c838a16c29b24c54e1 /runtime | |
parent | e2836f5f430e63bd96502cca74dbc302938e5a23 (diff) | |
parent | 0de862d5a6938b73a8b11d125946740c591a5a1f (diff) | |
download | rsyslog-f06862eff598b0355fa5e21424906e48dc7581da.tar.gz rsyslog-f06862eff598b0355fa5e21424906e48dc7581da.tar.xz rsyslog-f06862eff598b0355fa5e21424906e48dc7581da.zip |
Merge branch 'v5-stable' of git+ssh://git.adiscon.com/git/rsyslog into v5-stable
Conflicts:
ChangeLog
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/msg.c | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 7cc588b7..0744edd5 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1605,9 +1605,19 @@ static inline int getPROCIDLen(msg_t *pM, sbool bLockMutex) */ char *getPROCID(msg_t *pM, sbool bLockMutex) { + uchar *pszRet; + ISOBJ_TYPE_assert(pM, msg); - preparePROCID(pM, bLockMutex); - return (pM->pCSPROCID == NULL) ? "-" : (char*) cstrGetSzStrNoNULL(pM->pCSPROCID); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + preparePROCID(pM, MUTEX_ALREADY_LOCKED); + if(pM->pCSPROCID == NULL) + pszRet = UCHAR_CONSTANT(""); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSPROCID); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + return (char*) pszRet; } @@ -1834,7 +1844,15 @@ static int getStructuredDataLen(msg_t *pM) */ static inline char *getStructuredData(msg_t *pM) { - return (pM->pCSStrucData == NULL) ? "-" : (char*) rsCStrGetSzStrNoNULL(pM->pCSStrucData); + uchar *pszRet; + + MsgUnlock(pM); + if(pM->pCSStrucData == NULL) + pszRet = UCHAR_CONSTANT("-"); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSStrucData); + MsgUnlock(pM); + return (char*) pszRet; } @@ -1873,8 +1891,18 @@ int getProgramNameLen(msg_t *pM, sbool bLockMutex) */ uchar *getProgramName(msg_t *pM, sbool bLockMutex) { - prepareProgramName(pM, bLockMutex); - return (pM->pCSProgName == NULL) ? UCHAR_CONSTANT("") : rsCStrGetSzStrNoNULL(pM->pCSProgName); + uchar *pszRet; + + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + prepareProgramName(pM, MUTEX_ALREADY_LOCKED); + if(pM->pCSProgName == NULL) + pszRet = UCHAR_CONSTANT(""); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSProgName); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + return pszRet; } @@ -1920,9 +1948,19 @@ static inline void prepareAPPNAME(msg_t *pM, sbool bLockMutex) */ char *getAPPNAME(msg_t *pM, sbool bLockMutex) { + uchar *pszRet; + assert(pM != NULL); - prepareAPPNAME(pM, bLockMutex); - return (pM->pCSAPPNAME == NULL) ? "" : (char*) rsCStrGetSzStrNoNULL(pM->pCSAPPNAME); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + prepareAPPNAME(pM, MUTEX_ALREADY_LOCKED); + if(pM->pCSAPPNAME == NULL) + pszRet = UCHAR_CONSTANT(""); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSAPPNAME); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + return (char*)pszRet; } /* rgerhards, 2005-11-24 |