Fix: utils: utils_stream_file_path separator
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 9 Dec 2019 14:28:13 +0000 (09:28 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Dec 2019 22:13:11 +0000 (17:13 -0500)
Do not add a separator for empty paths.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icec7b07d7abab4c010706c8cb4f199229fa04c6f
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/utils.c

index f3cb9e0306e599a3b7aef48bce1812cfc7d6a03a..d79985a16ce601ba419b57b41374b018b062b48e 100644 (file)
@@ -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 = "/";
This page took 0.027968 seconds and 5 git commands to generate.