NetBSD-Docs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: system(3) return code



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


Home | Main Index | Thread Index | Old Index