From bf10e6efd441bcd261c325323dda0957d529abf5 Mon Sep 17 00:00:00 2001 From: David McCullough Date: Sun, 1 Dec 2002 23:32:17 +0000 Subject: If the wait failed in pclose it would return a random status code instead of -1 as expected. --- libc/stdio/popen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libc/stdio/popen.c') diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c index ddf881899..2fd1fa832 100644 --- a/libc/stdio/popen.c +++ b/libc/stdio/popen.c @@ -64,7 +64,8 @@ int pclose(FILE *fd) if (fclose(fd) != 0) { return EOF; } - wait(&waitstat); + if (wait(&waitstat) == -1) + return -1; return waitstat; } -- cgit v1.2.3