Explorar o código

If the wait failed in pclose it would return a random status code
instead of -1 as expected.

David McCullough %!s(int64=21) %!d(string=hai) anos
pai
achega
bf10e6efd4
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      libc/stdio/popen.c

+ 2 - 1
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;
 }