Skip to content

Commit

Permalink
ncc BUGFIX Clean backup dir properly after successful commit
Browse files Browse the repository at this point in the history
Without the fix, *.json and meta files are not cleaned
in /var/netopeer2/confirmed_commit/ folder.
  • Loading branch information
synther authored and michalvasko committed May 9, 2023
1 parent 1394674 commit 410aa8e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/netconf_confirmed_commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,11 @@ ncc_clean_backup_directory(void)
goto cleanup;
}
while ((dirent = readdir(dir))) {
if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, "..") ||
!strstr(".json", dirent->d_name) || strcmp(META_FILE, dirent->d_name)) {
if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, "..")) {
continue;
}

if (!strstr(dirent->d_name, ".json") && strcmp(META_FILE, dirent->d_name)) {
/* If some unexpected file, just skip */
continue;
}
Expand Down

0 comments on commit 410aa8e

Please sign in to comment.