From b1044cfa8f655eebab63e21a016cf8124bef5ca7 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sun, 4 Jan 2015 15:45:25 -0600 Subject: [PATCH] Properly report exit status values with the high bit set (128-255). These were being reported as strange values because the WEXITSTATUS macro from the GNO headers would erroneously sign-extend them. Thanks to Kelvin Sherlock for posting an example that demonstrated this problem. --- include/libbb.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/libbb.h b/include/libbb.h index 8229f055a..31a1e46a4 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -62,6 +62,11 @@ # include #endif #include +#ifdef __GNO__ +/* Fix definition of WEXITSTATUS to support values with the high bit set. */ +# undef WEXITSTATUS +# define WEXITSTATUS(x) (((*(int *)&(x)) >> 8) & 0xFF) +#endif #include #include #include