about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-02-03 17:09:47 -0500
committerRich Felker <dalias@aerifal.cx>2013-02-03 17:09:47 -0500
commit4862864fc1a6d162b297db09c216b136db83d7dd (patch)
treee7005707af3b8b89eb827423c6d02c154f86c0b7 /src
parentfb6b159d9ec7cf1e037daa974eeeacf3c8b3b3f1 (diff)
downloadmusl-4862864fc1a6d162b297db09c216b136db83d7dd.tar.gz
musl-4862864fc1a6d162b297db09c216b136db83d7dd.tar.xz
musl-4862864fc1a6d162b297db09c216b136db83d7dd.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/process/posix_spawn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c
index c55907d3..dd450129 100644
--- a/src/process/posix_spawn.c
+++ b/src/process/posix_spawn.c
@@ -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;