diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-06-20 22:40:10 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-06-20 23:03:58 -0400 |
commit | fd59d9f29838c3888168554c774003e7ad6d33b0 (patch) | |
tree | 9c079a2c4fe074a98daf9267f21121f39359609c /src/journal/journald-native.c | |
parent | 1021b21bc6f8dd522b46116e8598b17f9f93f1b7 (diff) |
Add hasprefix macro to check prefixes of fixed length
Diffstat (limited to 'src/journal/journald-native.c')
-rw-r--r-- | src/journal/journald-native.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index f878dfc911..ec9afa187d 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -158,23 +158,23 @@ void server_process_native_message( * of this entry for the rate limiting * logic */ if (l == 10 && - memcmp(p, "PRIORITY=", 9) == 0 && + hasprefix(p, "PRIORITY=") && p[9] >= '0' && p[9] <= '9') priority = (priority & LOG_FACMASK) | (p[9] - '0'); else if (l == 17 && - memcmp(p, "SYSLOG_FACILITY=", 16) == 0 && + hasprefix(p, "SYSLOG_FACILITY=") && p[16] >= '0' && p[16] <= '9') priority = (priority & LOG_PRIMASK) | ((p[16] - '0') << 3); else if (l == 18 && - memcmp(p, "SYSLOG_FACILITY=", 16) == 0 && + hasprefix(p, "SYSLOG_FACILITY=") && p[16] >= '0' && p[16] <= '9' && p[17] >= '0' && p[17] <= '9') priority = (priority & LOG_PRIMASK) | (((p[16] - '0')*10 + (p[17] - '0')) << 3); else if (l >= 19 && - memcmp(p, "SYSLOG_IDENTIFIER=", 18) == 0) { + hasprefix(p, "SYSLOG_IDENTIFIER=")) { char *t; t = strndup(p + 18, l - 18); @@ -183,7 +183,7 @@ void server_process_native_message( identifier = t; } } else if (l >= 8 && - memcmp(p, "MESSAGE=", 8) == 0) { + hasprefix(p, "MESSAGE=")) { char *t; t = strndup(p + 8, l - 8); |