static int purge_stale_dir(const char *path) { char p[PATH_MAX]; snprintf(p, PATH_MAX, "%s/.stale", path); return purge_dir(p); }
void purge_dir(tmp_dir *dir) { sc_dir_iterator *it = dir->search(); for (;!it->is_over();it->next()) { tmp_dirent *dirent = dir->find(it->value()); if (dirent->dir) { purge_dir(dirent->u.dir); } unlink(dirent->name); } delete it; }
// we dont care here about history of alloc'ed memory, yet. ~tmp_repo() { purge_dir(&root); }