diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-05-09 15:07:22 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-05-09 15:07:22 +0200 |
commit | fd4a54698cee48da073622f7d6ac49c94ccb1808 (patch) | |
tree | b16110018cd3a21a19561f45376403e1e8815cfb /runtime | |
parent | 88ff647aef4c6db3c444c6d080f9886350ca9584 (diff) | |
parent | 87a01476e2a63ab7b6740b6b4182281d271ef382 (diff) | |
download | rsyslog-fd4a54698cee48da073622f7d6ac49c94ccb1808.tar.gz rsyslog-fd4a54698cee48da073622f7d6ac49c94ccb1808.tar.xz rsyslog-fd4a54698cee48da073622f7d6ac49c94ccb1808.zip |
Merge branch 'v5-stable' into beta
Conflicts:
tools/omfwd.c
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/glbl.c | 6 | ||||
-rw-r--r-- | runtime/stream.c | 11 | ||||
-rw-r--r-- | runtime/strmsrv.c | 6 |
3 files changed, 21 insertions, 2 deletions
diff --git a/runtime/glbl.c b/runtime/glbl.c index 0114b1ac..71901dee 100644 --- a/runtime/glbl.c +++ b/runtime/glbl.c @@ -188,6 +188,11 @@ GetLocalHostName(void) { uchar *pszRet; + if(LocalHostNameOverride != NULL) { + pszRet = LocalHostNameOverride; + goto done; + } + if(LocalHostName == NULL) pszRet = (uchar*) "[localhost]"; else { @@ -196,6 +201,7 @@ GetLocalHostName(void) else pszRet = LocalHostName; } +done: return(pszRet); } diff --git a/runtime/stream.c b/runtime/stream.c index 24dbcc09..ae716815 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -259,6 +259,7 @@ static rsRetVal strmOpenFile(strm_t *pThis) if(pThis->fd != -1) ABORT_FINALIZE(RS_RET_OK); + pThis->pszCurrFName = NULL; /* used to prevent mem leak in case of error */ if(pThis->pszFName == NULL) ABORT_FINALIZE(RS_RET_FILE_PREFIX_MISSING); @@ -290,6 +291,16 @@ static rsRetVal strmOpenFile(strm_t *pThis) (pThis->tOperationsMode == STREAMMODE_READ) ? "READ" : "WRITE", pThis->fd); finalize_it: + if(iRet != RS_RET_OK) { + if(pThis->pszCurrFName != NULL) { + free(pThis->pszCurrFName); + pThis->pszCurrFName = NULL; /* just to prevent mis-adressing down the road... */ + } + if(pThis->fd != -1) { + close(pThis->fd); + pThis->fd = -1; + } + } RETiRet; } diff --git a/runtime/strmsrv.c b/runtime/strmsrv.c index e66ad717..f448cd4f 100644 --- a/runtime/strmsrv.c +++ b/runtime/strmsrv.c @@ -521,6 +521,7 @@ Run(strmsrv_t *pThis) strms_sess_t *pNewSess; nssel_t *pSel; ssize_t iRcvd; + rsRetVal localRet; ISOBJ_TYPE_assert(pThis, strmsrv); @@ -580,11 +581,12 @@ Run(strmsrv_t *pThis) break; case RS_RET_OK: /* valid data received, process it! */ - if(strms_sess.DataRcvd(pThis->pSessions[iSTRMSess], buf, iRcvd) != RS_RET_OK) { + localRet = strms_sess.DataRcvd(pThis->pSessions[iSTRMSess], buf, iRcvd); + if(localRet != RS_RET_OK) { /* in this case, something went awfully wrong. * We are instructed to terminate the session. */ - errmsg.LogError(0, NO_ERRCODE, "Tearing down STRM Session %d - see " + errmsg.LogError(0, localRet, "Tearing down STRM Session %d - see " "previous messages for reason(s)\n", iSTRMSess); pThis->pOnErrClose(pThis->pSessions[iSTRMSess]); strms_sess.Destruct(&pThis->pSessions[iSTRMSess]); |