[Pdbg] [PATCH 1/7] libpdbg: Fix CHECK_ERR macro to evaluate once in error case

Nicholas Piggin npiggin at gmail.com
Fri Mar 8 13:25:33 AEDT 2019


Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 libpdbg/operations.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libpdbg/operations.h b/libpdbg/operations.h
index dc5042a..85fc117 100644
--- a/libpdbg/operations.h
+++ b/libpdbg/operations.h
@@ -22,9 +22,10 @@
 
 #define PRINT_ERR PR_DEBUG("failed\n");
 #define CHECK_ERR(x) do {					\
-	if (x) {	       					\
+	typeof(x) __x = (x);					\
+	if (__x) {	       					\
 		PRINT_ERR;					\
-		return x;					\
+		return __x;					\
 	}							\
 	} while(0)
 
-- 
2.20.1



More information about the Pdbg mailing list