From 06cbfcc1cb3a81debea40e3bdce544115c21cee2 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 5 Nov 2018 21:50:58 +0100 Subject: [PATCH] Fix path for creating the log directory Signed-off-by: David Oberhollenzer --- syslogd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syslogd.c b/syslogd.c index e85a054..6c781b6 100644 --- a/syslogd.c +++ b/syslogd.c @@ -180,7 +180,10 @@ static int chroot_setup(void) memcpy(buffer, SYSLOG_PATH, len + 1); - for (i = 0; i < len; ++i) { + for (i = 0; i <= len && buffer[i] == '/'; ++i) + ; + + for (; i <= len; ++i) { if (buffer[i] == '\0' || buffer[i] == '/') { buffer[i] = '\0';