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.