summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/be_package.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/be_package.c')
-rw-r--r--lib/libalpm/be_package.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 7e8b7920..9bea295e 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -76,7 +76,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
if(strcmp(entry_name, ".CHANGELOG") == 0) {
changelog = malloc(sizeof(struct package_changelog));
if(!changelog) {
- pkg->handle->pm_errno = ALPM_ERR_MEMORY;
+ _alpm_set_errno(pkg->handle, ALPM_ERR_MEMORY);
_alpm_archive_read_free(archive);
close(fd);
return NULL;
@@ -276,7 +276,7 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
alpm_siglist_t **sigdata, int *validation)
{
int has_sig;
- handle->pm_errno = ALPM_ERR_OK;
+ _alpm_set_errno(handle, ALPM_ERR_OK);
if(pkgfile == NULL || strlen(pkgfile) == 0) {
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
@@ -285,11 +285,11 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
/* attempt to access the package file, ensure it exists */
if(_alpm_access(handle, NULL, pkgfile, R_OK) != 0) {
if(errno == ENOENT) {
- handle->pm_errno = ALPM_ERR_PKG_NOT_FOUND;
+ _alpm_set_errno(handle, ALPM_ERR_PKG_NOT_FOUND);
} else if(errno == EACCES) {
- handle->pm_errno = ALPM_ERR_BADPERMS;
+ _alpm_set_errno(handle, ALPM_ERR_BADPERMS);
} else {
- handle->pm_errno = ALPM_ERR_PKG_OPEN;
+ _alpm_set_errno(handle, ALPM_ERR_PKG_OPEN);
}
return -1;
}
@@ -337,13 +337,13 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
const char *sig = syncpkg ? syncpkg->base64_sig : NULL;
_alpm_log(handle, ALPM_LOG_DEBUG, "sig data: %s\n", sig ? sig : "<from .sig>");
if(!has_sig && !(level & ALPM_SIG_PACKAGE_OPTIONAL)) {
- handle->pm_errno = ALPM_ERR_PKG_MISSING_SIG;
+ _alpm_set_errno(handle, ALPM_ERR_PKG_MISSING_SIG);
return -1;
}
if(_alpm_check_pgp_helper(handle, pkgfile, sig,
level & ALPM_SIG_PACKAGE_OPTIONAL, level & ALPM_SIG_PACKAGE_MARGINAL_OK,
level & ALPM_SIG_PACKAGE_UNKNOWN_OK, sigdata)) {
- handle->pm_errno = ALPM_ERR_PKG_INVALID_SIG;
+ _alpm_set_errno(handle, ALPM_ERR_PKG_INVALID_SIG);
return -1;
}
if(validation && has_sig) {
@@ -458,7 +458,7 @@ static int build_filelist_from_mtree(alpm_handle_t *handle, alpm_pkg_t *pkg, str
/* create a new archive to parse the mtree and load it from archive into memory */
/* TODO: split this into a function */
if((mtree = archive_read_new()) == NULL) {
- handle->pm_errno = ALPM_ERR_LIBARCHIVE;
+ _alpm_set_errno(handle, ALPM_ERR_LIBARCHIVE);
goto error;
}
@@ -478,7 +478,7 @@ static int build_filelist_from_mtree(alpm_handle_t *handle, alpm_pkg_t *pkg, str
if(size < 0) {
_alpm_log(handle, ALPM_LOG_DEBUG, _("error while reading package %s: %s\n"),
pkg->filename, archive_error_string(archive));
- handle->pm_errno = ALPM_ERR_LIBARCHIVE;
+ _alpm_set_errno(handle, ALPM_ERR_LIBARCHIVE);
goto error;
}
if(size == 0) {
@@ -492,7 +492,7 @@ static int build_filelist_from_mtree(alpm_handle_t *handle, alpm_pkg_t *pkg, str
_alpm_log(handle, ALPM_LOG_DEBUG,
_("error while reading mtree of package %s: %s\n"),
pkg->filename, archive_error_string(mtree));
- handle->pm_errno = ALPM_ERR_LIBARCHIVE;
+ _alpm_set_errno(handle, ALPM_ERR_LIBARCHIVE);
goto error;
}
@@ -516,7 +516,7 @@ static int build_filelist_from_mtree(alpm_handle_t *handle, alpm_pkg_t *pkg, str
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occurred */
_alpm_log(handle, ALPM_LOG_DEBUG, _("error while reading mtree of package %s: %s\n"),
pkg->filename, archive_error_string(mtree));
- handle->pm_errno = ALPM_ERR_LIBARCHIVE;
+ _alpm_set_errno(handle, ALPM_ERR_LIBARCHIVE);
goto error;
}
@@ -571,22 +571,22 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
fd = _alpm_open_archive(handle, pkgfile, &st, &archive, ALPM_ERR_PKG_OPEN);
if(fd < 0) {
if(errno == ENOENT) {
- handle->pm_errno = ALPM_ERR_PKG_NOT_FOUND;
+ _alpm_set_errno(handle, ALPM_ERR_PKG_NOT_FOUND);
} else if(errno == EACCES) {
- handle->pm_errno = ALPM_ERR_BADPERMS;
+ _alpm_set_errno(handle, ALPM_ERR_BADPERMS);
} else {
- handle->pm_errno = ALPM_ERR_PKG_OPEN;
+ _alpm_set_errno(handle, ALPM_ERR_PKG_OPEN);
}
return NULL;
}
newpkg = _alpm_pkg_new();
if(newpkg == NULL) {
- handle->pm_errno = ALPM_ERR_MEMORY;
+ _alpm_set_errno(handle, ALPM_ERR_MEMORY);
goto error;
}
STRDUP(newpkg->filename, pkgfile,
- handle->pm_errno = ALPM_ERR_MEMORY; goto error);
+ _alpm_set_errno(handle, ALPM_ERR_MEMORY); goto error);
newpkg->size = st.st_size;
_alpm_log(handle, ALPM_LOG_DEBUG, "starting package load for %s\n", pkgfile);
@@ -636,7 +636,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
if(archive_read_data_skip(archive)) {
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
pkgfile, archive_error_string(archive));
- handle->pm_errno = ALPM_ERR_LIBARCHIVE;
+ _alpm_set_errno(handle, ALPM_ERR_LIBARCHIVE);
goto error;
}
@@ -649,7 +649,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occurred */
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
pkgfile, archive_error_string(archive));
- handle->pm_errno = ALPM_ERR_LIBARCHIVE;
+ _alpm_set_errno(handle, ALPM_ERR_LIBARCHIVE);
goto error;
}
@@ -686,7 +686,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
return newpkg;
pkg_invalid:
- handle->pm_errno = ALPM_ERR_PKG_INVALID;
+ _alpm_set_errno(handle, ALPM_ERR_PKG_INVALID);
error:
_alpm_pkg_free(newpkg);
_alpm_archive_read_free(archive);