Skip to content

Commit

Permalink
Only successful installs should be cached
Browse files Browse the repository at this point in the history
Make sure not to leave inconsistent data behind.
If the install failed, delete the pacakge dir, and the JSON cache
  • Loading branch information
Isty001 committed Nov 18, 2022
1 parent 90114c2 commit 0c19a04
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/common/clib-package.c
Original file line number Diff line number Diff line change
Expand Up @@ -1609,8 +1609,10 @@ int clib_package_install(clib_package_t *pkg, const char *dir, int verbose) {
clib_cache_save_package(pkg->author, pkg->name, pkg->version, pkg_dir);
_debug("cached package: %s/%s@%s", pkg->author, pkg->name, pkg->version);
} else {
clib_cache_delete_json(pkg->author, pkg->name, pkg->version);
_debug("deleted json cache: %s/%s@%s", pkg->author, pkg->name, pkg->version);
if (pkg) {
clib_cache_delete_json(pkg->author, pkg->name, pkg->version);
_debug("deleted json cache: %s/%s@%s", pkg->author, pkg->name, pkg->version);
}
}
#ifdef HAVE_PTHREADS
pthread_mutex_unlock(&lock.mutex);
Expand Down

0 comments on commit 0c19a04

Please sign in to comment.