[pacman-dev] [PATCH 1/3] Revise siglevel_t, adding PACKAGE_HASH_OK field

Kerrick Staley mail at kerrickstaley.com
Mon Jul 18 02:35:25 EDT 2011


The ALPM_SIG_PACKAGE_HASH_OK field indicates that secure hashes are to
be acceptable as signatures.

Also, having ALPM_SIG_USE_DEFAULT = (1 << 31) will cause alpm_siglevel_t
to be treated as an unsigned value on machines where int is 32 bits,
meaning negative numbers cannot be returned on error conditions. So,
make it (1 << 30). Still, there's no guarantee that signed
semantics will be used unless one of the enum values is negative. So,
supply ALPM_SIG_ERROR = -1 as a sort of dummy value (it can be used in
code, but "-1" is probably just as meaningful and is more consistent
with conventions used throughout the rest of the library).

Signed-off-by: Kerrick Staley <mail at kerrickstaley.com>
---
 lib/libalpm/alpm.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 6e1e4bc..ecd9173 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -94,13 +94,14 @@ typedef enum _alpm_siglevel_t {
 	ALPM_SIG_PACKAGE_OPTIONAL = (1 << 1),
 	ALPM_SIG_PACKAGE_MARGINAL_OK = (1 << 2),
 	ALPM_SIG_PACKAGE_UNKNOWN_OK = (1 << 3),
+	ALPM_SIG_PACKAGE_HASH_OK = (1 << 4),
 
 	ALPM_SIG_DATABASE = (1 << 10),
 	ALPM_SIG_DATABASE_OPTIONAL = (1 << 11),
 	ALPM_SIG_DATABASE_MARGINAL_OK = (1 << 12),
 	ALPM_SIG_DATABASE_UNKNOWN_OK = (1 << 13),
 
-	ALPM_SIG_USE_DEFAULT = (1 << 31)
+	ALPM_SIG_USE_DEFAULT = (1 << 30)
 } alpm_siglevel_t;
 
 /**
-- 
1.7.6



More information about the pacman-dev mailing list