diff options
author | Ivy Foster <ivy.foster@gmail.com> | 2016-10-12 15:13:31 -0500 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2016-10-22 20:50:55 +1000 |
commit | a55adb81d0f6fcd7fe98cc444806b3b0d25efc9c (patch) | |
tree | 8bf6a8b9f048a9b1073d964ffcead9015f404bd0 /lib/libalpm | |
parent | a79be86f5751b4341f1339a32a5a8737439ac28d (diff) | |
download | pacman-a55adb81d0f6fcd7fe98cc444806b3b0d25efc9c.tar.xz |
Add ALPM_ERR_OK to _alpm_errno_t
This allows functions which return an _alpm_errno_t to always return a
genuine _alpm_errno_t for consistency, even in cases where there are
no errors. Since ALPM_ERR_OK = 0, their callers can still simply check
'err = some_fn(); if (!err) { ... }'.
Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/alpm.h | 3 | ||||
-rw-r--r-- | lib/libalpm/be_package.c | 2 | ||||
-rw-r--r-- | lib/libalpm/be_sync.c | 4 | ||||
-rw-r--r-- | lib/libalpm/db.c | 16 | ||||
-rw-r--r-- | lib/libalpm/dload.c | 2 | ||||
-rw-r--r-- | lib/libalpm/package.c | 78 | ||||
-rw-r--r-- | lib/libalpm/signing.c | 6 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 8 | ||||
-rw-r--r-- | lib/libalpm/util.h | 2 |
9 files changed, 61 insertions, 60 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 7955585a..0f8274bb 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -53,7 +53,8 @@ typedef struct __alpm_trans_t alpm_trans_t; * @{ */ typedef enum _alpm_errno_t { - ALPM_ERR_MEMORY = 1, + ALPM_ERR_OK = 0, + ALPM_ERR_MEMORY, ALPM_ERR_SYSTEM, ALPM_ERR_BADPERMS, ALPM_ERR_NOT_A_FILE, diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 430d2aeb..befcba31 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -274,7 +274,7 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle, alpm_siglist_t **sigdata, alpm_pkgvalidation_t *validation) { int has_sig; - handle->pm_errno = 0; + handle->pm_errno = ALPM_ERR_OK; if(pkgfile == NULL || strlen(pkgfile) == 0) { RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1); diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index a8362778..856aa420 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -186,7 +186,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) /* Sanity checks */ ASSERT(db != NULL, return -1); handle = db->handle; - handle->pm_errno = 0; + handle->pm_errno = ALPM_ERR_OK; ASSERT(db != handle->db_local, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); ASSERT(db->servers != NULL, RET_ERR(handle, ALPM_ERR_SERVER_NONE, -1)); @@ -330,7 +330,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) _alpm_log(handle, ALPM_LOG_DEBUG, "failed to sync db: %s\n", alpm_strerror(handle->pm_errno)); } else { - handle->pm_errno = 0; + handle->pm_errno = ALPM_ERR_OK; } _alpm_handle_unlock(handle); diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index f70f83c1..46d2ccf3 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -112,7 +112,7 @@ int SYMEXPORT alpm_db_unregister(alpm_db_t *db) ASSERT(db != NULL, return -1); /* Do not unregister a database if a transaction is on-going */ handle = db->handle; - handle->pm_errno = 0; + handle->pm_errno = ALPM_ERR_OK; ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1)); if(db == handle->db_local) { @@ -179,7 +179,7 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url) /* Sanity checks */ ASSERT(db != NULL, return -1); - db->handle->pm_errno = 0; + db->handle->pm_errno = ALPM_ERR_OK; ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1)); newurl = sanitize_url(url); @@ -206,7 +206,7 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url) /* Sanity checks */ ASSERT(db != NULL, return -1); - db->handle->pm_errno = 0; + db->handle->pm_errno = ALPM_ERR_OK; ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1)); newurl = sanitize_url(url); @@ -249,7 +249,7 @@ alpm_siglevel_t SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db) int SYMEXPORT alpm_db_get_valid(alpm_db_t *db) { ASSERT(db != NULL, return -1); - db->handle->pm_errno = 0; + db->handle->pm_errno = ALPM_ERR_OK; return db->ops->validate(db); } @@ -258,7 +258,7 @@ alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name) { alpm_pkg_t *pkg; ASSERT(db != NULL, return NULL); - db->handle->pm_errno = 0; + db->handle->pm_errno = ALPM_ERR_OK; ASSERT(name != NULL && strlen(name) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, NULL)); @@ -273,7 +273,7 @@ alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name) alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(alpm_db_t *db) { ASSERT(db != NULL, return NULL); - db->handle->pm_errno = 0; + db->handle->pm_errno = ALPM_ERR_OK; return _alpm_db_get_pkgcache(db); } @@ -292,7 +292,7 @@ alpm_group_t SYMEXPORT *alpm_db_get_group(alpm_db_t *db, const char *name) alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db) { ASSERT(db != NULL, return NULL); - db->handle->pm_errno = 0; + db->handle->pm_errno = ALPM_ERR_OK; return _alpm_db_get_groupcache(db); } @@ -301,7 +301,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db) alpm_list_t SYMEXPORT *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles) { ASSERT(db != NULL, return NULL); - db->handle->pm_errno = 0; + db->handle->pm_errno = ALPM_ERR_OK; return _alpm_db_search(db, needles); } diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index dc57c929..9d803580 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -412,7 +412,7 @@ static int curl_download_internal(struct dload_payload *payload, /* shortcut to our handle within the payload */ alpm_handle_t *handle = payload->handle; CURL *curl = get_libcurl_handle(handle); - handle->pm_errno = 0; + handle->pm_errno = ALPM_ERR_OK; /* make sure these are NULL */ FREE(payload->tempfile_name); diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index f08df8b2..a666bf05 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -60,7 +60,7 @@ int SYMEXPORT alpm_pkg_checkmd5sum(alpm_pkg_t *pkg) int retval; ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; /* We only inspect packages from sync repositories */ ASSERT(pkg->origin == ALPM_PKG_FROM_SYNCDB, RET_ERR(pkg->handle, ALPM_ERR_WRONG_ARGS, -1)); @@ -184,196 +184,196 @@ struct pkg_operations default_pkg_ops = { const char SYMEXPORT *alpm_pkg_get_filename(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->filename; } const char SYMEXPORT *alpm_pkg_get_base(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_base(pkg); } const char SYMEXPORT *alpm_pkg_get_name(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->name; } const char SYMEXPORT *alpm_pkg_get_version(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->version; } alpm_pkgfrom_t SYMEXPORT alpm_pkg_get_origin(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->origin; } const char SYMEXPORT *alpm_pkg_get_desc(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_desc(pkg); } const char SYMEXPORT *alpm_pkg_get_url(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_url(pkg); } alpm_time_t SYMEXPORT alpm_pkg_get_builddate(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_builddate(pkg); } alpm_time_t SYMEXPORT alpm_pkg_get_installdate(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_installdate(pkg); } const char SYMEXPORT *alpm_pkg_get_packager(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_packager(pkg); } const char SYMEXPORT *alpm_pkg_get_md5sum(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->md5sum; } const char SYMEXPORT *alpm_pkg_get_sha256sum(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->sha256sum; } const char SYMEXPORT *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->base64_sig; } const char SYMEXPORT *alpm_pkg_get_arch(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_arch(pkg); } off_t SYMEXPORT alpm_pkg_get_size(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->size; } off_t SYMEXPORT alpm_pkg_get_isize(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_isize(pkg); } alpm_pkgreason_t SYMEXPORT alpm_pkg_get_reason(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_reason(pkg); } alpm_pkgvalidation_t SYMEXPORT alpm_pkg_get_validation(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_validation(pkg); } alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_licenses(pkg); } alpm_list_t SYMEXPORT *alpm_pkg_get_groups(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_groups(pkg); } alpm_list_t SYMEXPORT *alpm_pkg_get_depends(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_depends(pkg); } alpm_list_t SYMEXPORT *alpm_pkg_get_optdepends(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_optdepends(pkg); } alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_conflicts(pkg); } alpm_list_t SYMEXPORT *alpm_pkg_get_provides(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_provides(pkg); } alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_replaces(pkg); } alpm_list_t SYMEXPORT *alpm_pkg_get_deltas(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->deltas; } alpm_filelist_t SYMEXPORT *alpm_pkg_get_files(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_files(pkg); } alpm_list_t SYMEXPORT *alpm_pkg_get_backup(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->get_backup(pkg); } @@ -382,7 +382,7 @@ alpm_db_t SYMEXPORT *alpm_pkg_get_db(alpm_pkg_t *pkg) /* Sanity checks */ ASSERT(pkg != NULL, return NULL); ASSERT(pkg->origin != ALPM_PKG_FROM_FILE, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->origin_data.db; } @@ -391,7 +391,7 @@ alpm_db_t SYMEXPORT *alpm_pkg_get_db(alpm_pkg_t *pkg) void SYMEXPORT *alpm_pkg_changelog_open(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->changelog_open(pkg); } @@ -400,7 +400,7 @@ size_t SYMEXPORT alpm_pkg_changelog_read(void *ptr, size_t size, const alpm_pkg_t *pkg, void *fp) { ASSERT(pkg != NULL, return 0); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->changelog_read(ptr, size, pkg, fp); } @@ -408,7 +408,7 @@ size_t SYMEXPORT alpm_pkg_changelog_read(void *ptr, size_t size, int SYMEXPORT alpm_pkg_changelog_close(const alpm_pkg_t *pkg, void *fp) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->changelog_close(pkg, fp); } @@ -416,7 +416,7 @@ int SYMEXPORT alpm_pkg_changelog_close(const alpm_pkg_t *pkg, void *fp) struct archive SYMEXPORT *alpm_pkg_mtree_open(alpm_pkg_t * pkg) { ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->mtree_open(pkg); } @@ -425,7 +425,7 @@ int SYMEXPORT alpm_pkg_mtree_next(const alpm_pkg_t * pkg, struct archive *archiv struct archive_entry **entry) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->mtree_next(pkg, archive, entry); } @@ -433,14 +433,14 @@ int SYMEXPORT alpm_pkg_mtree_next(const alpm_pkg_t * pkg, struct archive *archiv int SYMEXPORT alpm_pkg_mtree_close(const alpm_pkg_t * pkg, struct archive *archive) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->mtree_close(pkg, archive); } int SYMEXPORT alpm_pkg_has_scriptlet(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return pkg->ops->has_scriptlet(pkg); } @@ -448,7 +448,7 @@ static void find_requiredby(alpm_pkg_t *pkg, alpm_db_t *db, alpm_list_t **reqs, int optional) { const alpm_list_t *i; - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; for(i = _alpm_db_get_pkgcache(db); i; i = i->next) { alpm_pkg_t *cachepkg = i->data; @@ -478,7 +478,7 @@ static alpm_list_t *compute_requiredby(alpm_pkg_t *pkg, int optional) alpm_db_t *db; ASSERT(pkg != NULL, return NULL); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; if(pkg->origin == ALPM_PKG_FROM_FILE) { /* The sane option; search locally for things that require this. */ diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index 6557c200..527e763f 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -771,7 +771,7 @@ int _alpm_check_pgp_helper(alpm_handle_t *handle, const char *path, if(ret && handle->pm_errno == ALPM_ERR_SIG_MISSING) { if(optional) { _alpm_log(handle, ALPM_LOG_DEBUG, "missing optional signature\n"); - handle->pm_errno = 0; + handle->pm_errno = ALPM_ERR_OK; ret = 0; } else { _alpm_log(handle, ALPM_LOG_DEBUG, "missing required signature\n"); @@ -931,7 +931,7 @@ int SYMEXPORT alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, { ASSERT(pkg != NULL, return -1); ASSERT(siglist != NULL, RET_ERR(pkg->handle, ALPM_ERR_WRONG_ARGS, -1)); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; return _alpm_gpgme_checksig(pkg->handle, pkg->filename, pkg->base64_sig, siglist); @@ -948,7 +948,7 @@ int SYMEXPORT alpm_db_check_pgp_signature(alpm_db_t *db, { ASSERT(db != NULL, return -1); ASSERT(siglist != NULL, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1)); - db->handle->pm_errno = 0; + db->handle->pm_errno = ALPM_ERR_OK; return _alpm_gpgme_checksig(db->handle, _alpm_db_path(db), NULL, siglist); } diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 00b68d05..65c1bbc6 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -57,7 +57,7 @@ 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); - pkg->handle->pm_errno = 0; + pkg->handle->pm_errno = ALPM_ERR_OK; for(i = dbs_sync; !spkg && i; i = i->next) { alpm_db_t *db = i->data; @@ -460,7 +460,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 = 0; + handle->pm_errno = ALPM_ERR_OK; if(data) { alpm_list_free_inner(*data, (alpm_list_fn_free)alpm_depmissing_free); @@ -1195,7 +1195,7 @@ static int check_validity(alpm_handle_t *handle, } alpm_list_free(errors); - if(!handle->pm_errno) { + if(handle->pm_errno == ALPM_ERR_OK) { RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1); } return -1; @@ -1280,7 +1280,7 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data, EVENT(handle, &event); if(errors) { - if(!handle->pm_errno) { + if(handle->pm_errno == ALPM_ERR_OK) { RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1); } return -1; diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index 5a2c105d..b9c5c172 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -77,7 +77,7 @@ void _alpm_alloc_fail(size_t size); #define DOUBLE_EQ(x, y) (fabs((x) - (y)) < DBL_EPSILON) -#define CHECK_HANDLE(handle, action) do { if(!(handle)) { action; } (handle)->pm_errno = 0; } while(0) +#define CHECK_HANDLE(handle, action) do { if(!(handle)) { action; } (handle)->pm_errno = ALPM_ERR_OK; } while(0) /** Standard buffer size used throughout the library. */ #ifdef BUFSIZ |