diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-09 09:15:14 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-09 09:15:14 +0100 |
commit | de7726cbf0957384cc9261ac47d6bf65906739b5 (patch) | |
tree | 1d3dd581d5c2382c01d3bf39130b368ae0cc64e2 /runtime/datetime.c | |
parent | a27c67a590a4a6186ac79326fa3abe4b95ab10fc (diff) | |
parent | d97ad63e218112d7cd3a390854b2918407804976 (diff) | |
download | rsyslog-de7726cbf0957384cc9261ac47d6bf65906739b5.tar.gz rsyslog-de7726cbf0957384cc9261ac47d6bf65906739b5.tar.xz rsyslog-de7726cbf0957384cc9261ac47d6bf65906739b5.zip |
Merge branch 'v4-stable' into v5-stable
Conflicts:
ChangeLog
runtime/datetime.h
Diffstat (limited to 'runtime/datetime.c')
-rw-r--r-- | runtime/datetime.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/datetime.c b/runtime/datetime.c index 47d7ac0e..de26762d 100644 --- a/runtime/datetime.c +++ b/runtime/datetime.c @@ -811,8 +811,12 @@ int formatTimestamp3339(struct syslogTime *ts, char* pBuf) * buffer that will receive the resulting string. The function * returns the size of the timestamp written in bytes (without * the string termnator). If 0 is returend, an error occured. + * rgerhards, 2010-03-05: Added support to for buggy 3164 dates, + * where a zero-digit is written instead of a space for the first + * day character if day < 10. syslog-ng seems to do that, and some + * parsing scripts (in migration cases) rely on that. */ -int formatTimestamp3164(struct syslogTime *ts, char* pBuf) +int formatTimestamp3164(struct syslogTime *ts, char* pBuf, int bBuggyDay) { static char* monthNames[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -825,7 +829,7 @@ int formatTimestamp3164(struct syslogTime *ts, char* pBuf) pBuf[2] = monthNames[(ts->month - 1) % 12][2]; pBuf[3] = ' '; iDay = (ts->day / 10) % 10; /* we need to write a space if the first digit is 0 */ - pBuf[4] = iDay ? iDay + '0' : ' '; + pBuf[4] = (bBuggyDay || iDay > 0) ? iDay + '0' : ' '; pBuf[5] = ts->day % 10 + '0'; pBuf[6] = ' '; pBuf[7] = (ts->hour / 10) % 10 + '0'; |