diff options
Diffstat (limited to 'tools/smfwd.c')
-rw-r--r-- | tools/smfwd.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/tools/smfwd.c b/tools/smfwd.c index 60fe94a..62bf7fe 100644 --- a/tools/smfwd.c +++ b/tools/smfwd.c @@ -9,24 +9,23 @@ * * File begun on 2010-06-01 by RGerhards * - * Copyright 2010 Rainer Gerhards and Adiscon GmbH. + * Copyright 2010-2014 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * - * Rsyslog is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Rsyslog is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>. - * - * A copy of the GPL can be found in the file "COPYING" in this distribution. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #include "config.h" #include "rsyslog.h" @@ -91,33 +90,35 @@ CODESTARTstrgen ++lenTotal; /* then we need to introduce one additional space */ /* now make sure buffer is large enough */ - if(lenTotal >= *pLenBuf) - CHKiRet(ExtendBuf(ppBuf, pLenBuf, lenTotal)); + if(lenTotal >= iparam->lenBuf) + CHKiRet(ExtendBuf(iparam, lenTotal)); /* and concatenate the resulting string */ - **ppBuf = '<'; - memcpy(*ppBuf + 1, pPRI, lenPRI); + iparam->param[0] = '<'; + memcpy(iparam->param + 1, pPRI, lenPRI); iBuf = lenPRI + 1; - *(*ppBuf + iBuf++) = '>'; + iparam->param[iBuf++] = '>'; - memcpy(*ppBuf + iBuf, pTimeStamp, lenTimeStamp); + memcpy(iparam->param + iBuf, pTimeStamp, lenTimeStamp); iBuf += lenTimeStamp; - *(*ppBuf + iBuf++) = ' '; + iparam->param[iBuf++] = ' '; - memcpy(*ppBuf + iBuf, pHOSTNAME, lenHOSTNAME); + memcpy(iparam->param + iBuf, pHOSTNAME, lenHOSTNAME); iBuf += lenHOSTNAME; - *(*ppBuf + iBuf++) = ' '; + iparam->param[iBuf++] = ' '; - memcpy(*ppBuf + iBuf, pTAG, lenTAG); + memcpy(iparam->param + iBuf, pTAG, lenTAG); iBuf += lenTAG; if(pMSG[0] != ' ') - *(*ppBuf + iBuf++) = ' '; - memcpy(*ppBuf + iBuf, pMSG, lenMSG); + iparam->param[iBuf++] = ' '; + memcpy(iparam->param + iBuf, pMSG, lenMSG); iBuf += lenMSG; /* string terminator */ - *(*ppBuf + iBuf) = '\0'; + iparam->param[iBuf] = '\0'; + + iparam->lenStr = lenTotal - 1; /* do not count \0! */ finalize_it: ENDstrgen |