aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorChris Sarra <chrissarra@google.com>2020-09-08 12:16:47 -0700
committerRob Landley <rob@landley.net>2020-09-08 23:54:07 -0500
commit6dedeb79511b4bbdcd2e1fbac10e2aa5d74930c5 (patch)
tree71ec9c09d3cd3dcef520b9d90c8bcca1f081b407 /toys/posix
parenta7fe8d598ce8f4b0163ba72609aaa2c66f6a4315 (diff)
downloadtoybox-6dedeb79511b4bbdcd2e1fbac10e2aa5d74930c5.tar.gz
logger.c was failing to properly log local0-local6 facilities, due to a string parsing error. This patch enables proper local facility handling.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/logger.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/toys/posix/logger.c b/toys/posix/logger.c
index 3bcfb174..d1cc7291 100644
--- a/toys/posix/logger.c
+++ b/toys/posix/logger.c
@@ -64,9 +64,10 @@ void logger_main(void)
else {
*s1++ = len = 0;
facility = arrayfind(TT.p, facilities, ARRAY_LEN(facilities));
- if (facility == -1 && strncasecmp(TT.p, "local", 5)) {
- facility = s1[5]-'0';
- if (facility>7 || s1[6]) facility = -1;
+ if (facility == -1 && strncasecmp(TT.p, "local", 5) == 0) {
+ s2 = TT.p;
+ facility = s2[5]-'0';
+ if (facility>7 || s2[6]) facility = -1;
if (facility>=0) facility += 16;
}
if (facility<0) error_exit("bad facility: %s", TT.p);