summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4dbe187)
Tweak _lttng_index_file_create_from_trace_chunk() to correctly deal with
empty channel_path string, removing redundant "/" separators.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I743917c27e334ad12e145959b3ad3f59f62f1a64
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
char index_file_path[LTTNG_PATH_MAX];
const mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
const bool acquired_reference = lttng_trace_chunk_get(chunk);
char index_file_path[LTTNG_PATH_MAX];
const mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
const bool acquired_reference = lttng_trace_chunk_get(chunk);
assert(acquired_reference);
assert(acquired_reference);
}
index_file->trace_chunk = chunk;
}
index_file->trace_chunk = chunk;
+ if (channel_path[0] == '\0') {
+ separator = "";
+ } else {
+ separator = "/";
+ }
ret = snprintf(index_directory_path, sizeof(index_directory_path),
ret = snprintf(index_directory_path, sizeof(index_directory_path),
- "%s/" DEFAULT_INDEX_DIR, channel_path);
+ "%s%s" DEFAULT_INDEX_DIR, channel_path, separator);
if (ret < 0 || ret >= sizeof(index_directory_path)) {
ERR("Failed to format index directory path");
goto error;
if (ret < 0 || ret >= sizeof(index_directory_path)) {
ERR("Failed to format index directory path");
goto error;