Re: system(3) return code
Martin Husemann <[email protected]> Mon, 7 Nov 2022 21:21:40 +0100
| Newsgroups | gmane.os.netbsd.documentation |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Nov 07, 2022 at 02:55:20PM -0500, Jan Schaumann wrote:
> While that is the case, that's internal to system(3);
> the end result for the user is that system(3) will
> return 127.
No, it is not internal to system. The system(3) man page says:
Otherwise, system() returns the termination status of the shell in the
format specified by waitpid(2).
and it is only "accidently" 127 since
#define WIFEXITED(x) (_WSTATUS(x) == 0)
so the upper bits are zero.
Martin