diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-23 16:32:29 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-23 16:32:29 +0200 |
commit | 662ad3e4bf8dbd317d18aa1afcbf3e8b9e424506 (patch) | |
tree | e4c346465041a26de7237ffaeca0aa711d007263 /runtime/msg.c | |
parent | 86e37f70fe0e9de0e00362990c73536843c8fef3 (diff) | |
download | rsyslog-662ad3e4bf8dbd317d18aa1afcbf3e8b9e424506.tar.gz rsyslog-662ad3e4bf8dbd317d18aa1afcbf3e8b9e424506.tar.xz rsyslog-662ad3e4bf8dbd317d18aa1afcbf3e8b9e424506.zip |
optimized hostname processing
Diffstat (limited to 'runtime/msg.c')
-rw-r--r-- | runtime/msg.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 8c306aca..6cf41322 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1439,7 +1439,7 @@ int getHOSTNAMELen(msg_t *pM) return 0; else if(pM->pszHOSTNAME == NULL) - return 0; + return pM->iLenRcvFrom; else return pM->iLenHOSTNAME; } @@ -1451,7 +1451,7 @@ char *getHOSTNAME(msg_t *pM) return ""; else if(pM->pszHOSTNAME == NULL) - return ""; + return (char*) pM->pszRcvFrom; else return (char*) pM->pszHOSTNAME; } @@ -1720,12 +1720,12 @@ void MsgAssignHOSTNAME(msg_t *pMsg, char *pBuf) * we need it. The rest of the code already knows how to handle an * unset HOSTNAME. */ -void MsgSetHOSTNAME(msg_t *pMsg, uchar* pszHOSTNAME) +void MsgSetHOSTNAME(msg_t *pMsg, uchar* pszHOSTNAME, int lenHOSTNAME) { assert(pMsg != NULL); free(pMsg->pszHOSTNAME); - pMsg->iLenHOSTNAME = ustrlen(pszHOSTNAME); + pMsg->iLenHOSTNAME = lenHOSTNAME; if((pMsg->pszHOSTNAME = malloc(pMsg->iLenHOSTNAME + 1)) != NULL) memcpy(pMsg->pszHOSTNAME, pszHOSTNAME, pMsg->iLenHOSTNAME + 1); else @@ -2719,7 +2719,7 @@ rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp) } else if(isProp("pszRcvFrom")) { MsgSetRcvFrom(pThis, rsCStrGetSzStrNoNULL(pProp->val.pStr)); } else if(isProp("pszHOSTNAME")) { - MsgSetHOSTNAME(pThis, rsCStrGetSzStrNoNULL(pProp->val.pStr)); + MsgSetHOSTNAME(pThis, rsCStrGetSzStrNoNULL(pProp->val.pStr), rsCStrLen(pProp->val.pStr)); } else if(isProp("pCSStrucData")) { MsgSetStructuredData(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr)); } else if(isProp("pCSAPPNAME")) { |