mirror of
https://github.com/fluencelabs/musl
synced 2025-06-28 06:02:04 +00:00
fix unsigned comparison bug in posix_spawn
read should never return anything but 0 or sizeof ec here, but if it does, we want to treat any other return as "success". then the caller will get back the pid and is responsible for waiting on it when it immediately exits.
This commit is contained in:
@ -152,7 +152,7 @@ int __posix_spawnx(pid_t *restrict res, const char *restrict path,
|
||||
close(args.p[1]);
|
||||
|
||||
if (pid > 0) {
|
||||
if (read(args.p[0], &ec, sizeof ec) < sizeof ec) ec = 0;
|
||||
if (read(args.p[0], &ec, sizeof ec) != sizeof ec) ec = 0;
|
||||
else waitpid(pid, &(int){0}, 0);
|
||||
} else {
|
||||
ec = -pid;
|
||||
|
Reference in New Issue
Block a user