syslog: Remove extra whitespace between timestamp and message (BZ#29544)
The rfc3164 clear states that a single space character must follow the timestamp field. Checked on x86_64-linux-gnu.
This commit is contained in:
parent
930993921f
commit
45459476ec
|
@ -275,16 +275,19 @@ parse_syslog_msg (const char *msg)
|
||||||
{
|
{
|
||||||
struct msg_t r = { .pid = -1 };
|
struct msg_t r = { .pid = -1 };
|
||||||
int number;
|
int number;
|
||||||
|
int wsb, wsa;
|
||||||
|
|
||||||
#define STRINPUT(size) XSTRINPUT(size)
|
#define STRINPUT(size) XSTRINPUT(size)
|
||||||
#define XSTRINPUT(size) "%" # size "s"
|
#define XSTRINPUT(size) "%" # size "s"
|
||||||
|
|
||||||
/* The message in the form:
|
/* The message in the form:
|
||||||
<179>Apr 8 14:51:19 tst-syslog: message 176 3 */
|
<179>Apr 8 14:51:19 tst-syslog: message 176 3 */
|
||||||
int n = sscanf (msg, "<%3d>%*s %*d %*d:%*d:%*d " STRINPUT(IDENT_LENGTH)
|
int n = sscanf (msg, "<%3d>%*s %*d %*d:%*d:%*d%n %n" STRINPUT(IDENT_LENGTH)
|
||||||
" " STRINPUT(MSG_LENGTH) " %*d %*d",
|
" " STRINPUT(MSG_LENGTH) " %*d %*d",
|
||||||
&number, r.ident, r.msg);
|
&number, &wsb, &wsa, r.ident, r.msg);
|
||||||
TEST_COMPARE (n, 3);
|
TEST_COMPARE (n, 3);
|
||||||
|
/* It should only one space between timestamp and message. */
|
||||||
|
TEST_COMPARE (wsa - wsb, 1);
|
||||||
|
|
||||||
r.facility = number & LOG_FACMASK;
|
r.facility = number & LOG_FACMASK;
|
||||||
r.priority = number & LOG_PRIMASK;
|
r.priority = number & LOG_PRIMASK;
|
||||||
|
|
Loading…
Reference in a new issue