| 169 | } |
| 170 | |
| 171 | static void cleanup_backup_artifacts(const char *cache_dir) { |
| 172 | cbm_dir_t *dir = cbm_opendir(cache_dir); |
| 173 | if (!dir) { |
| 174 | return; |
| 175 | } |
| 176 | |
| 177 | cbm_dirent_t *entry; |
| 178 | while ((entry = cbm_readdir(dir)) != NULL) { |
| 179 | if (!is_backup_artifact_name(entry->name)) { |
| 180 | continue; |
| 181 | } |
| 182 | char path[800]; |
| 183 | snprintf(path, sizeof(path), "%s/%s", cache_dir, entry->name); |
| 184 | cbm_unlink(path); |
| 185 | } |
| 186 | cbm_closedir(dir); |
| 187 | } |
| 188 | |
| 189 | /* ── Test ───────────────────────────────────────────────────────────── |
| 190 | * |
no test coverage detected