- sync: populates *data when a conflict can't be resolved

- add: code cleanup
This commit is contained in:
Aurelien Foret 2006-01-06 22:58:01 +00:00
parent c2b27b5880
commit db8a5e3586
2 changed files with 20 additions and 2 deletions

View File

@ -242,7 +242,11 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
if(!errorout) {
errorout = 1;
}
MALLOC(miss, sizeof(pmdepmissing_t));
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
FREELIST(lp);
FREELIST(*data);
RET_ERR(PM_ERR_MEMORY, -1);
}
*miss = *(pmdepmissing_t*)i->data;
*data = pm_list_add(*data, miss);
}

View File

@ -514,20 +514,34 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
/* abort */
_alpm_log(PM_LOG_ERROR, "package conflicts detected");
errorout = 1;
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
goto error;
}
*miss = *(pmdepmissing_t *)i->data;
*data = pm_list_add(*data, miss);
}
}
} else {
_alpm_log(PM_LOG_ERROR, "%s conflicts with %s", miss->target, miss->depend.name);
errorout = 1;
if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
goto error;
}
*miss = *(pmdepmissing_t *)i->data;
*data = pm_list_add(*data, miss);
}
}
}
}
FREELIST(deps);
if(errorout) {
pm_errno = PM_ERR_CONFLICTING_DEPS;
goto error;
}
FREELIST(deps);
}
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_DONE, NULL, NULL);