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.
This commit is contained in:
Stephen Heumann 2015-01-04 15:45:25 -06:00
parent ba87092078
commit b1044cfa8f
1 changed files with 5 additions and 0 deletions

View File

@ -62,6 +62,11 @@
# include <sys/sysmacros.h>
#endif
#include <sys/wait.h>
#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 <time.h>
#include <sys/param.h>
#include <pwd.h>