lib/util: call _alpm_log before setting handle->pm_errno

This is an unfortunate chain of events. RET_ERR and RET_ERR_VOID will
eventually call CHECK_HANDLE, which resets the handle's pm_errno member.
Dan probably had a reason for doing this, so we merely switch the order
of operations in the RET_ERR macros to avoid stomping on our pm_errno.

Signed-off-by: Dave Reisner <d@falconindy.com>
This commit is contained in:
Dave Reisner 2011-06-18 19:21:21 -04:00 committed by Dan McGee
parent 81e6071e0f
commit 3847446603
1 changed files with 4 additions and 2 deletions

View File

@ -61,12 +61,14 @@
#define ASSERT(cond, action) do { if(!(cond)) { action; } } while(0)
#define RET_ERR_VOID(handle, err) do { (handle)->pm_errno = (err); \
#define RET_ERR_VOID(handle, err) do { \
_alpm_log(handle, PM_LOG_DEBUG, "returning error %d from %s : %s\n", err, __func__, alpm_strerror(err)); \
(handle)->pm_errno = (err); \
return; } while(0)
#define RET_ERR(handle, err, ret) do { (handle)->pm_errno = (err); \
#define RET_ERR(handle, err, ret) do { \
_alpm_log(handle, PM_LOG_DEBUG, "returning error %d from %s : %s\n", err, __func__, alpm_strerror(err)); \
(handle)->pm_errno = (err); \
return (ret); } while(0)
#define DOUBLE_EQ(x, y) (fabs((x) - (y)) < DBL_EPSILON)