Skip to content

Commit

Permalink
Update dlt_offline_logstorage_behavior.c
Browse files Browse the repository at this point in the history
  • Loading branch information
lvklevankhanh authored Dec 4, 2023
1 parent 2a0cb2f commit 22f7f64
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/offlinelogstorage/dlt_offline_logstorage_behavior.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,10 @@ int dlt_logstorage_open_log_file(DltLogStorageFilterConfig *config,
* remove it and reopen it.
* In this case number of log file won't be increased*/
if (config->wrap_id && stat(absolute_file_path, &s) == 0) {
if (remove(absolute_file_path) != 0)
dlt_log(LOG_ERR, "Could not remove file\n");
if (stat(absolute_file_path, &s) == 0) {
if (remove(absolute_file_path) != 0)

Check failure

Code scanning / CodeQL

Time-of-check time-of-use filesystem race condition High

The
filename
being operated upon was previously
checked
, but the underlying file may have been changed since then.
The
filename
being operated upon was previously
checked
, but the underlying file may have been changed since then.
The
filename
being operated upon was previously
checked
, but the underlying file may have been changed since then.
The
filename
being operated upon was previously
checked
, but the underlying file may have been changed since then.
dlt_log(LOG_ERR, "Could not remove file\n");
}
num_log_files -= 1;
dlt_vlog(LOG_DEBUG,
"%s: Remove '%s' (num_log_files: %u, config->num_files:%u)\n",
Expand Down

0 comments on commit 22f7f64

Please sign in to comment.