From e45523ea270ff696e665ec93a9bc378164661dcc Mon Sep 17 00:00:00 2001 From: gustav Date: Fri, 8 Nov 2024 15:11:39 +0100 Subject: [PATCH] Fix compare of file suffix File suffix only checked the initial char, not the entire ending. Replace check with strcmp. --- src/offlinelogstorage/dlt_offline_logstorage_behavior.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c index dc5f6794..aff3a631 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c +++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c @@ -382,11 +382,13 @@ int dlt_logstorage_storage_dir_info(DltLogStorageUserConfig *file_config, if (strncmp(files[i]->d_name, file_name, len) == 0) { if (config->num_files == 1 && file_config->logfile_optional_counter) { /* .dlt or _.dlt */ - if ((files[i]->d_name[len] == suffix[0]) || + if (strcmp(files[i]->d_name + len, suffix) == 0 || (file_config->logfile_timestamp && - (files[i]->d_name[len] == file_config->logfile_delimiter))) { + (files[i]->d_name[len] == + file_config->logfile_delimiter))) { current_idx = 1; - } else { + } + else { continue; } } else {