From 3999ac15b48a13fd53562659fc080b0393dd3cc3 Mon Sep 17 00:00:00 2001 From: Jani Taskinen Date: Thu, 4 Jun 2009 11:53:38 +0000 Subject: [PATCH] MFH:- Fixed bug #48419 (non-portable STDIN fileno in cgi_main.c) # This doesn't really fix it since it's some weird Windows thing but this # does make this code slightly more portable :) --- sapi/cgi/cgi_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index d621ec96a6..8bcc46b96e 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -461,6 +461,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) { @@ -473,10 +476,10 @@ 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); } #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); #endif if (tmp_read_bytes <= 0) { -- 2.40.0