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 a080927 commit 90114c2
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 @@ -1578,8 +1578,10 @@ int clib_package_install(clib_package_t *pkg, const char *dir, int verbose) {

cleanup:
if (pkg_dir) {
rimraf(pkg_dir);
_debug("deleted inconsistent package dir: %s", pkg_dir);
if (0 != rc) {
rimraf(pkg_dir);
_debug("deleted inconsistent package dir: %s", pkg_dir);
}

free(pkg_dir);
}
Expand Down

0 comments on commit 90114c2

Please sign in to comment.