bug-make
[Top][All Lists]
Advanced

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

Re: [bug #63070] posix_spawn fails to run a child process.


From: Edward Welbourne
Subject: Re: [bug #63070] posix_spawn fails to run a child process.
Date: Wed, 21 Sep 2022 10:42:53 +0000

Alejandro Colomar (21 September 2022 11:46)
>> If the function is returning 0, there's no error, and errno shouldn't be read

> I guess you maybe didn't state it here as obvious, but to me it's not by
> reading the conversation: Apart from posix_spawn(3) returning 0 and setting
> errno to ENOEXEC, I guess you're seeing something else, such as a child
> returning 127?
>
> If so, I think I understand the problem you're trying to explain.
>
> Otherwise, glibc is allowed to set errno without failing, and you shouldn't be
> reading errno as it's meaningless.

If it's hard to restructure code to avoid something reading errno after
the call, it's of course possible to evaluate

  (posix_spawn(...) || errno = 0)

instead of posix_spawn(...), which won't change the value but will
ensure errno is clear after success.

        Eddy.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]