summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/remove.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 10e89b18..8f778576 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -146,7 +146,6 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
/* iterate through the list backwards, unlinking files */
for(lp = pm_list_last(info->files); lp; lp = lp->prev) {
- char *newpath = NULL;
int nb = 0;
char *file = lp->data;
if(_alpm_needbackup(lp->data, info->backup)) {
@@ -175,8 +174,8 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
/* we're upgrading so just leave the file as is. pacman_add() will handle it */
} else {
if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) {
- newpath = (char*)realloc(newpath, strlen(line)+strlen(".pacsave")+1);
- sprintf(newpath, "%s.pacsave", line);
+ char newpath[PATH_MAX];
+ snprintf(newpath, PATH_MAX, "%s.pacsave", line);
rename(line, newpath);
_alpm_log(PM_LOG_WARNING, "%s saved as %s", file, newpath);
alpm_logaction("%s saved as %s", line, newpath);
@@ -212,6 +211,7 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
_alpm_log(PM_LOG_ERROR, "failed to remove database entry %s/%s-%s", db->treename, info->name, info->version);
}
+
/* update dependency packages' REQUIREDBY fields */
_alpm_log(PM_LOG_FLOW2, "updating dependency packages 'requiredby' fields");
for(lp = info->depends; lp; lp = lp->next) {
@@ -219,7 +219,9 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
pmpkg_t *depinfo = NULL;
pmdepend_t depend;
- splitdep((char*)lp->data, &depend);
+ if(splitdep((char*)lp->data, &depend)) {
+ continue;
+ }
depinfo = db_scan(db, depend.name, INFRQ_DESC|INFRQ_DEPENDS);
if(depinfo == NULL) {