diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/gpg/error.h | 5 |
2 files changed, 9 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2003-05-26 Marcus Brinkmann <[email protected]> + + * src/gpg/error.h (gpg_make_error): Only OR in the error source if + there is an error, this allows to test for success with "if (!err)" + and similar tests. + 2003-05-15 Marcus Brinkmann <[email protected]> * src/mkstrtable.awk: Add exception clause to license about the diff --git a/src/gpg/error.h b/src/gpg/error.h index 990a265..1803cfe 100644 --- a/src/gpg/error.h +++ b/src/gpg/error.h @@ -241,8 +241,9 @@ typedef unsigned long gpg_error_t; static __inline__ gpg_error_t gpg_make_error (gpg_err_source_t source, gpg_err_code_t code) { - return ((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT) - | (code & GPG_ERR_CODE_MASK); + return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR + : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT) + | (code & GPG_ERR_CODE_MASK)); } |