index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-06-07 16:06:16 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-13 19:38:38 -0500 |
commit | e2aa952689da8763d534d1c19310eb97009f4f76 (patch) | |
tree | 7d022d67801bc01c24fef985feb9a617c48d316a /lib/libalpm/remove.c | |
parent | 8b62d9bc0ade64897990b8fc6a1b6a54b629cb5b (diff) |
-rw-r--r-- | lib/libalpm/remove.c | 25 |
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 30403f70..09cb0276 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -51,17 +51,17 @@ int SYMEXPORT alpm_remove_pkg(pmhandle_t *handle, pmpkg_t *pkg) /* Sanity checks */ ASSERT(handle != NULL, return -1); - ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); - ASSERT(handle == pkg->handle, RET_ERR(PM_ERR_WRONG_ARGS, -1)); + ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(handle == pkg->handle, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); trans = handle->trans; - ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); ASSERT(trans->state == STATE_INITIALIZED, - RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1)); + RET_ERR(handle, PM_ERR_TRANS_NOT_INITIALIZED, -1)); pkgname = pkg->name; if(_alpm_pkg_find(trans->remove, pkgname)) { - RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); + RET_ERR(handle, PM_ERR_TRANS_DUP_TARGET, -1); } _alpm_log(PM_LOG_DEBUG, "adding package %s to the transaction remove list\n", @@ -166,7 +166,7 @@ int _alpm_remove_prepare(pmhandle_t *handle, alpm_list_t **data) alpm_list_free_inner(lp, (alpm_list_fn_free)_alpm_depmiss_free); alpm_list_free(lp); } - RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1); + RET_ERR(handle, PM_ERR_UNSATISFIED_DEPS, -1); } } } @@ -191,11 +191,12 @@ int _alpm_remove_prepare(pmhandle_t *handle, alpm_list_t **data) return 0; } -static int can_remove_file(pmhandle_t *handle, const char *path, alpm_list_t *skip) +static int can_remove_file(const char *root, const char *path, + alpm_list_t *skip) { char file[PATH_MAX]; - snprintf(file, PATH_MAX, "%s%s", handle->root, path); + snprintf(file, PATH_MAX, "%s%s", root, path); if(alpm_list_find_str(skip, file)) { /* return success because we will never actually remove this file */ @@ -319,10 +320,10 @@ int _alpm_upgraderemove_package(pmhandle_t *handle, } for(lp = files; lp; lp = lp->next) { - if(!can_remove_file(handle, lp->data, skip_remove)) { + if(!can_remove_file(handle->root, lp->data, skip_remove)) { _alpm_log(PM_LOG_DEBUG, "not removing package '%s', can't remove all files\n", pkgname); - RET_ERR(PM_ERR_PKG_CANT_REMOVE, -1); + RET_ERR(handle, PM_ERR_PKG_CANT_REMOVE, -1); } } @@ -395,10 +396,10 @@ int _alpm_remove_packages(pmhandle_t *handle) size_t filenum; for(lp = files; lp; lp = lp->next) { - if(!can_remove_file(handle, lp->data, NULL)) { + if(!can_remove_file(handle->root, lp->data, NULL)) { _alpm_log(PM_LOG_DEBUG, "not removing package '%s', can't remove all files\n", pkgname); - RET_ERR(PM_ERR_PKG_CANT_REMOVE, -1); + RET_ERR(handle, PM_ERR_PKG_CANT_REMOVE, -1); } } |