diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2015-01-22 06:29:53 +0100 |
---|---|---|
committer | Andrew Gregory <andrew.gregory.8@gmail.com> | 2017-05-11 06:45:30 +0200 |
commit | 2e63d6aa7fcdfd89f02758f02f5799a291405b40 (patch) | |
tree | 03a2661f903afdbc6539b6530bf90aece2b4e55a /lib/libalpm/sync.c | |
parent | 4143760a944470d50975ee27da9e3380223e88b9 (diff) | |
download | pacman-2e63d6aa7fcdfd89f02758f02f5799a291405b40.tar.gz pacman-2e63d6aa7fcdfd89f02758f02f5799a291405b40.tar.xz |
make pm_errno thread-local
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r-- | lib/libalpm/sync.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index ae0f1e49..c1579753 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -57,7 +57,11 @@ alpm_pkg_t SYMEXPORT *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_syn alpm_pkg_t *spkg = NULL; ASSERT(pkg != NULL, return NULL); +<<<<<<< HEAD pkg->handle->pm_errno = ALPM_ERR_OK; +======= + _alpm_set_errno(pkg->handle, ALPM_ERR_OK); +>>>>>>> make pm_errno thread-local for(i = dbs_sync; !spkg && i; i = i->next) { alpm_db_t *db = i->data; @@ -460,7 +464,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) transaction. The packages will be removed from the actual transaction when the transaction packages are replaced with a dependency-reordered list below */ - handle->pm_errno = ALPM_ERR_OK; + _alpm_set_errno(handle, ALPM_ERR_OK); if(data) { alpm_list_free_inner(*data, (alpm_list_fn_free)alpm_depmissing_free); @@ -469,7 +473,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) } } else { /* pm_errno was set by resolvedeps, callback may have overwrote it */ - handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS; + _alpm_set_errno(handle, ALPM_ERR_UNSATISFIED_DEPS); alpm_list_free(resolved); alpm_list_free(unresolvable); ret = -1; @@ -534,7 +538,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) sync = sync2; } else { _alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n")); - handle->pm_errno = ALPM_ERR_CONFLICTING_DEPS; + _alpm_set_errno(handle, ALPM_ERR_CONFLICTING_DEPS); ret = -1; if(data) { alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict); @@ -604,7 +608,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) sync->removes = alpm_list_add(sync->removes, local); } else { /* abort */ _alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n")); - handle->pm_errno = ALPM_ERR_CONFLICTING_DEPS; + _alpm_set_errno(handle, ALPM_ERR_CONFLICTING_DEPS); ret = -1; if(data) { alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict); @@ -644,7 +648,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) deps = alpm_checkdeps(handle, _alpm_db_get_pkgcache(handle->db_local), trans->remove, trans->add, 1); if(deps) { - handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS; + _alpm_set_errno(handle, ALPM_ERR_UNSATISFIED_DEPS); ret = -1; if(data) { *data = deps; @@ -785,7 +789,7 @@ static int apply_deltas(alpm_handle_t *handle) /* one delta failed for this package, cancel the remaining ones */ event.type = ALPM_EVENT_DELTA_PATCH_FAILED; EVENT(handle, &event); - handle->pm_errno = ALPM_ERR_DLT_PATCHFAILED; + _alpm_set_errno(handle, ALPM_ERR_DLT_PATCHFAILED); ret = 1; break; } @@ -855,7 +859,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas) FREE(filepath); } alpm_list_free(errors); - handle->pm_errno = ALPM_ERR_DLT_INVALID; + _alpm_set_errno(handle, ALPM_ERR_DLT_INVALID); return -1; } return 0; @@ -885,9 +889,9 @@ static int find_dl_candidates(alpm_db_t *repo, alpm_list_t **files, alpm_list_t alpm_list_t *delta_path = spkg->delta_path; if(!repo->servers) { - handle->pm_errno = ALPM_ERR_SERVER_NONE; + _alpm_set_errno(handle, ALPM_ERR_SERVER_NONE); _alpm_log(handle, ALPM_LOG_ERROR, "%s: %s\n", - alpm_strerror(handle->pm_errno), repo->treename); + alpm_strerror(alpm_errno(handle)), repo->treename); return 1; } @@ -1154,7 +1158,7 @@ static int check_validity(alpm_handle_t *handle, if(_alpm_pkg_validate_internal(handle, v.path, v.pkg, v.siglevel, &v.siglist, &v.validation) == -1) { struct validity *invalid; - v.error = handle->pm_errno; + v.error = alpm_errno(handle); MALLOC(invalid, sizeof(struct validity), return -1); memcpy(invalid, &v, sizeof(struct validity)); errors = alpm_list_add(errors, invalid); @@ -1193,7 +1197,7 @@ static int check_validity(alpm_handle_t *handle, } alpm_list_free(errors); - if(handle->pm_errno == ALPM_ERR_OK) { + if(alpm_errno(handle) == ALPM_ERR_OK) { RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1); } return -1; @@ -1278,7 +1282,7 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data, EVENT(handle, &event); if(errors) { - if(handle->pm_errno == ALPM_ERR_OK) { + if(alpm_errno(handle) == ALPM_ERR_OK) { RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1); } return -1; |