summaryrefslogtreecommitdiffstats
path: root/srUtils.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-10 07:03:22 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-10 07:03:22 +0000
commitc247f4e02771960f5c880dc50a3003f786faefac (patch)
treed1c5079827af77c703b77de5d6199174242e0ce2 /srUtils.c
parentdee5485ade5b77748f2cebcd6b65ea71f01123f8 (diff)
downloadrsyslog-c247f4e02771960f5c880dc50a3003f786faefac.tar.gz
rsyslog-c247f4e02771960f5c880dc50a3003f786faefac.tar.xz
rsyslog-c247f4e02771960f5c880dc50a3003f786faefac.zip
changed queue file name generation (to be more generic)
Diffstat (limited to 'srUtils.c')
-rwxr-xr-xsrUtils.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/srUtils.c b/srUtils.c
index b500cab3..fc0869be 100755
--- a/srUtils.c
+++ b/srUtils.c
@@ -240,13 +240,12 @@ void skipWhiteSpace(uchar **pp)
/* generate a file name from four parts:
- * <directory name>/<prefix>-<number>.<type>
+ * <directory name>/<name>.<number>
* If number is negative, it is not used. If any of the strings is
* NULL, an empty string is used instead. Length must be provided.
* rgerhards, 2008-01-03
*/
-rsRetVal genFileName(uchar **ppName, uchar *pDirName, size_t lenDirName,
- uchar *pPrefix, size_t lenPrefix, long lNum, uchar *pType, size_t lenType)
+rsRetVal genFileName(uchar **ppName, uchar *pDirName, size_t lenDirName, uchar *pFName, size_t lenFName, long lNum)
{
DEFiRet;
uchar *pName;
@@ -259,10 +258,10 @@ rsRetVal genFileName(uchar **ppName, uchar *pDirName, size_t lenDirName,
szBuf[0] = '\0';
lenBuf = 0;
} else {
- lenBuf = snprintf((char*)szBuf, sizeof(szBuf), "-%ld", lNum);
+ lenBuf = snprintf((char*)szBuf, sizeof(szBuf), ".%ld", lNum);
}
- lenName = lenDirName + 1 + lenPrefix + lenBuf + 1 + lenType + 1; /* last +1 for \0 char! */
+ lenName = lenDirName + 1 + lenName + lenBuf + 1; /* last +1 for \0 char! */
if((pName = malloc(sizeof(uchar) * lenName)) == NULL)
ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
@@ -270,15 +269,12 @@ rsRetVal genFileName(uchar **ppName, uchar *pDirName, size_t lenDirName,
memcpy(pName, pDirName, lenDirName);
pNameWork = pName + lenDirName;
*pNameWork++ = '/';
- memcpy(pNameWork, pPrefix, lenPrefix);
- pNameWork += lenPrefix;
+ memcpy(pNameWork, pFName, lenFName);
+ pNameWork += lenFName;
if(lenBuf > 0) {
memcpy(pNameWork, szBuf, lenBuf);
pNameWork += lenBuf;
}
- *pNameWork++ = '.';
- memcpy(pNameWork, pType, lenType);
- pNameWork += lenType;
*pNameWork = '\0';
*ppName = pName;