summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSaya Sugiura <ssugiura@jp.adit-jv.com>2019-02-04 16:57:15 +0900
committerSaya Sugiura <ssugiura@jp.adit-jv.com>2019-06-18 17:22:09 +0900
commitb049b408f7b15ef5ecdc71723812f43161d25ce8 (patch)
tree321179e307dc1ff0fc16191fe14c7b9b50035d4d /src
parent5cacbe15f75cb5af1a19e50d382039ae13c53499 (diff)
downloadDLT-daemon-b049b408f7b15ef5ecdc71723812f43161d25ce8.tar.gz
Logstorage: Fix write msg cache
When the message is just fitting to the remaining cache, it is ignored and goes to the head. This commit fixes to add the message to the end. Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
Diffstat (limited to 'src')
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage_behavior.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
index 1d31f46..5d9576b 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
@@ -821,7 +821,7 @@ int dlt_logstorage_prepare_on_msg(DltLogStorageFilterConfig *config,
if (ret == 0) {
/* check if adding new data do not exceed max file size */
- if (s.st_size + log_msg_size >= (int)config->file_size) {
+ if (s.st_size + log_msg_size > (int)config->file_size) {
fclose(config->log);
config->log = NULL;
ret = dlt_logstorage_open_log_file(config,
@@ -1090,7 +1090,7 @@ int dlt_logstorage_write_msg_cache(DltLogStorageFilterConfig *config,
remain_cache_size = config->file_size - footer->offset;
}
- if (msg_size < remain_cache_size) { /* add at current position */
+ if (msg_size <= remain_cache_size) { /* add at current position */
curr_write_addr = (void *)(config->cache + footer->offset);
footer->offset += msg_size;
}
@@ -1152,10 +1152,6 @@ int dlt_logstorage_write_msg_cache(DltLogStorageFilterConfig *config,
footer->offset = msg_size;
footer->wrap_around_cnt += 1;
}
- else { /* message just fits into cache */
- curr_write_addr = (void *)(config->cache + footer->offset);
- footer->wrap_around_cnt += 1;
- }
/* write data to cache */
memcpy(curr_write_addr, data1, size1);