From 77c00bc26de91696181c9a99658c51ebef7b945c Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Mon, 5 Oct 2015 15:57:02 +0200 Subject: [PATCH] fs_log: fix creation of '.log' files Issue #1538 --- repos/os/src/server/fs_log/main.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/repos/os/src/server/fs_log/main.cc b/repos/os/src/server/fs_log/main.cc index 79fa9c7f68..c6ebc47b73 100644 --- a/repos/os/src/server/fs_log/main.cc +++ b/repos/os/src/server/fs_log/main.cc @@ -104,7 +104,13 @@ class Fs_log::Root_component : if ((strcmp((dir_path+label_len)-3, " ->", 4) == 0) || (strcmp((dir_path+label_len)-4, " -> ", 5) == 0)) { - for (size_t i = 0; *(label_str+i); ++i) { + for (size_t i = 0;; ++i) { + if (label_prefix[i] == '\0') { + strncpy(dir_path+1, label_str, MAX_PATH_LEN-1); + label_prefix = nullptr; + break; + } + if (strcmp(label_prefix+i, " -> ", 4)) continue; @@ -112,8 +118,6 @@ class Fs_log::Root_component : label_prefix += i+4; break; } - - if (*label_prefix == ' ') ++label_prefix; } } else