Explorar el Código

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

David McCullough hace 21 años
padre
commit
bf10e6efd4
Se han modificado 1 ficheros con 2 adiciones y 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;
 }