On Jan 7, 1:39 pm, AJ ONeal <
coola...@gmail.com> wrote:
> BTW, tried what you suggested with mixed results.
>
> WEXITSTATUS seems to reliably return 1 on error, but it doesn't seem to
> reliably return 0 on success.
>
> Rather it returns 141.
Yeah, I noticed that from the numbers you gave before, that applying
the macro to 36096 yielded 141 on my system. I was hoping maybe your
C library (assuming it isn't glibc) encoded the values a little
differently. Apparently not.
When you return 0, is WIFEXITED(status) true? WEXITSTATUS() is only
supposed to be used in that case. Other than that, I'm not sure what
might be going on. According to the docs, WEXITSTATUS(status) should
give you the low-order byte of the exit status of the child. I've
never seen any problem with this before, but I'm not sure I've ever
used it the way you are.
You might want to post a question on the libc help mailing list. This
may be a bug.
Good luck!
--
Shawn.