[pacman-dev] [PATCH 3/5] Remove argument from check_pgp_helper

Dan McGee dan at archlinux.org
Thu Aug 25 01:11:01 EDT 2011


This one wasn't all that necessary as we only used it in one place in
the function, which can be checked easily enough at the call site.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 lib/libalpm/be_package.c |    3 ++-
 lib/libalpm/be_sync.c    |    3 ++-
 lib/libalpm/signing.c    |    7 +------
 lib/libalpm/signing.h    |    3 +--
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 8028754..deec0c4 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -349,7 +349,8 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
 	if(level & ALPM_SIG_PACKAGE &&
 			_alpm_check_pgp_helper(handle, pkgfile, base64_sig,
 				level & ALPM_SIG_PACKAGE_OPTIONAL, level & ALPM_SIG_PACKAGE_MARGINAL_OK,
-				level & ALPM_SIG_PACKAGE_UNKNOWN_OK, ALPM_ERR_PKG_INVALID_SIG)) {
+				level & ALPM_SIG_PACKAGE_UNKNOWN_OK)) {
+		handle->pm_errno = ALPM_ERR_PKG_INVALID_SIG;
 		_alpm_pkg_free(newpkg);
 		return NULL;
 	}
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 6e64e5f..d7c0a74 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -102,7 +102,8 @@ static int sync_db_validate(alpm_db_t *db)
 	if(level & ALPM_SIG_DATABASE) {
 		if(_alpm_check_pgp_helper(db->handle, dbpath, NULL,
 					level & ALPM_SIG_DATABASE_OPTIONAL, level & ALPM_SIG_DATABASE_MARGINAL_OK,
-					level & ALPM_SIG_DATABASE_UNKNOWN_OK, ALPM_ERR_DB_INVALID_SIG)) {
+					level & ALPM_SIG_DATABASE_UNKNOWN_OK)) {
+			db->handle->pm_errno = ALPM_ERR_DB_INVALID_SIG;
 			return 1;
 		}
 	}
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index 8af8a99..2ca7cce 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -438,8 +438,7 @@ char *_alpm_sigpath(alpm_handle_t *handle, const char *path)
 }
 
 int _alpm_check_pgp_helper(alpm_handle_t *handle, const char *path,
-		const char *base64_sig, int optional, int marginal, int unknown,
-		enum _alpm_errno_t invalid_err)
+		const char *base64_sig, int optional, int marginal, int unknown)
 {
 	alpm_siglist_t siglist;
 	int ret;
@@ -497,10 +496,6 @@ int _alpm_check_pgp_helper(alpm_handle_t *handle, const char *path,
 					break;
 			}
 		}
-
-		if(ret) {
-			handle->pm_errno = invalid_err;
-		}
 	}
 
 	alpm_siglist_cleanup(&siglist);
diff --git a/lib/libalpm/signing.h b/lib/libalpm/signing.h
index 6cb1656..8e47b2c 100644
--- a/lib/libalpm/signing.h
+++ b/lib/libalpm/signing.h
@@ -25,8 +25,7 @@ char *_alpm_sigpath(alpm_handle_t *handle, const char *path);
 int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
 		const char *base64_sig, alpm_siglist_t *result);
 int _alpm_check_pgp_helper(alpm_handle_t *handle, const char *path,
-		const char *base64_sig, int optional, int marginal, int unknown,
-		enum _alpm_errno_t invalid_err);
+		const char *base64_sig, int optional, int marginal, int unknown);
 
 #endif /* _ALPM_SIGNING_H */
 
-- 
1.7.6



More information about the pacman-dev mailing list