]> granicus.if.org Git - php/commitdiff
MFH:- Fixed bug #48419 (non-portable STDIN fileno in cgi_main.c)
authorJani Taskinen <jani@php.net>
Thu, 4 Jun 2009 11:51:43 +0000 (11:51 +0000)
committerJani Taskinen <jani@php.net>
Thu, 4 Jun 2009 11:51:43 +0000 (11:51 +0000)
sapi/cgi/cgi_main.c

index e636a1f9f1d0e4c06cb65c224da8fba121905c9e..61a4e4b4aeb44879d2b43ef127143209fff38376 100644 (file)
@@ -481,6 +481,9 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
        return SAPI_HEADER_SENT_SUCCESSFULLY;
 }
 
+#ifndef STDIN_FILENO
+# define STDIN_FILENO 0
+#endif
 
 static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
 {
@@ -493,7 +496,7 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
                        fcgi_request *request = (fcgi_request*) SG(server_context);
                        tmp_read_bytes = fcgi_read(request, buffer + read_bytes, count_bytes - read_bytes);
                } else {
-                       tmp_read_bytes = read(0, buffer + read_bytes, count_bytes - read_bytes);
+                       tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes);
                }
                if (tmp_read_bytes <= 0) {
                        break;