From: Mathieu Desnoyers Date: Mon, 9 Dec 2019 14:28:13 +0000 (-0500) Subject: Fix: utils: utils_stream_file_path separator X-Git-Tag: v2.12.0-rc1~162 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d248f3c28f1697b44615d368baadb04a94ceae04;p=lttng-tools.git Fix: utils: utils_stream_file_path separator Do not add a separator for empty paths. Signed-off-by: Mathieu Desnoyers Change-Id: Icec7b07d7abab4c010706c8cb4f199229fa04c6f Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/utils.c b/src/common/utils.c index f3cb9e030..d79985a16 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -744,7 +744,8 @@ int utils_stream_file_path(const char *path_name, const char *file_name, char count_str[MAX_INT_DEC_LEN(count) + 1] = {}; const char *path_separator; - if (path_name && path_name[strlen(path_name) - 1] == '/') { + if (path_name && (path_name[0] == '\0' || + path_name[strlen(path_name) - 1] == '/')) { path_separator = ""; } else { path_separator = "/";