Return-Path: Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 49530 invoked by uid 500); 11 Nov 2001 17:01:02 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 49519 invoked by uid 500); 11 Nov 2001 17:01:02 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 11 Nov 2001 16:48:26 -0000 Message-ID: <20011111164826.49575.qmail@icarus.apache.org> From: jerenkrantz@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/generators mod_cgid.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N jerenkrantz 01/11/11 08:48:26 Modified: . CHANGES modules/generators mod_cgid.c Log: apr_file_gets returns an apr_status_t not a char* and it returns APR_SUCCESS when it reads something (which is 0). Two of the cases were doing while apr_file_gets > 0 which would cause it to loop when it returned APR_EOF. So, the valid check here is to loop while we are receiving APR_SUCCESS. Fix all of the other apr_file_gets to check APR_SUCCESS explicitly so that it is obvious that we are checking an apr_status_t. Yes, 0 == APR_SUCCESS, but it obviously wasn't clear to someone what it was returning. Submitted by: Dale Ghent , Brian Pane Reviewed by: Justin Erenkrantz Revision Changes Path 1.428 +3 -0 httpd-2.0/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/httpd-2.0/CHANGES,v retrieving revision 1.427 retrieving revision 1.428 diff -u -r1.427 -r1.428 --- CHANGES 2001/11/11 07:02:37 1.427 +++ CHANGES 2001/11/11 16:48:26 1.428 @@ -1,5 +1,8 @@ Changes with Apache 2.0.29-dev + *) Fix infinite loop in mod_cgid.c. + [Dale Ghent , Brian Pane ] + *) Add Debian layout. [Daniel Stone ] *) If shared modules are requested and mod_so is not available, 1.100 +15 -8 httpd-2.0/modules/generators/mod_cgid.c Index: mod_cgid.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v retrieving revision 1.99 retrieving revision 1.100 diff -u -r1.99 -r1.100 --- mod_cgid.c 2001/10/12 21:39:40 1.99 +++ mod_cgid.c 2001/11/11 16:48:26 1.100 @@ -764,10 +764,12 @@ (apr_file_open(&f, conf->logname, APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) { /* Soak up script output */ - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) + while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, + script_in) == APR_SUCCESS) continue; if (script_err) { - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == 0) + while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, + script_err) == APR_SUCCESS) continue; } return ret; @@ -804,19 +806,22 @@ if (sbuf && *sbuf) apr_file_printf(f, "%s\n", sbuf); - if (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) { + if (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == APR_SUCCESS) { apr_file_puts("%stdout\n", f); apr_file_puts(argsbuffer, f); - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_in) == 0) + while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, + script_in) == APR_SUCCESS) apr_file_puts(argsbuffer, f); apr_file_puts("\n", f); } if (script_err) { - if (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == 0) { + if (apr_file_gets(argsbuffer, HUGE_STRING_LEN, + script_err) == APR_SUCCESS) { apr_file_puts("%stderr\n", f); apr_file_puts(argsbuffer, f); - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == 0) + while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, + script_err) == APR_SUCCESS) apr_file_puts(argsbuffer, f); apr_file_puts("\n", f); } @@ -990,7 +995,8 @@ if (location && location[0] == '/' && r->status == 200) { /* Soak up all the script output */ - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, tempsock) > 0) { + while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, + tempsock) == APR_SUCCESS) { continue; } /* This redirect needs to be a GET no matter what the original @@ -1196,7 +1202,8 @@ char argsbuffer[HUGE_STRING_LEN]; /* Soak up all the script output */ - while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, tempsock) > 0) { + while (apr_file_gets(argsbuffer, HUGE_STRING_LEN, + tempsock) == APR_SUCCESS) { continue; } /* This redirect needs to be a GET no matter what the original