Justin Erenkrantz wrote:

>[ Cliff sent me a note that mod_include is generating warnings... ]
>
>On Mon, Sep 03, 2001 at 12:17:38AM -0400, Cliff Woolley wrote:
>
>>On Sun, 2 Sep 2001, Justin Erenkrantz wrote:
>>
>>>On Mon, Sep 03, 2001 at 12:08:35AM -0400, Cliff Woolley wrote:
>>>
>>>>mod_include.c: In function `find_start_sequence':
>>>>mod_include.c:226: warning: `rv' might be used uninitialized in this
>>>>function
>>>>mod_include.c:245: warning: `start_index' might be used uninitialized in
>>>>this function
>>>>mod_include.c: In function `find_end_sequence':
>>>>mod_include.c:344: warning: `rv' might be used uninitialized in this
>>>>function
>>>>
>
>The warnings on 226 and 344 can just be silenced by adding = 0 to the
>rv decl.  I do wonder if the !SUCCESS check should be moved inside of 
>the !read_done block.  I actually don't think it should be - consider
>the case of lines 237/354 returning an error condition.  It'd be
>caught at line 265/373.  So, I do think adding = 0 silences the
>warning, but realistically by the time we hit lines 265/373, we've
>already set rv.  (My gcc doesn't emit these warnings under -Wall - 
>what version are you using?)
>
>However, the warning for 245 looks like a legitimate bug on our
>part.  I'm guessing start_index should have been set to 
>ctx->head_start_index, but 0 may be right too.  I'm not sure.
>-- justin
>
Yep, that's a real bug on 245.  Here's a patch:

Index: modules/filters/mod_include.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/filters/mod_include.c,v
retrieving revision 1.141
diff -u -r1.141 mod_include.c
--- modules/filters/mod_include.c    2001/09/02 17:44:39    1.141
+++ modules/filters/mod_include.c    2001/09/03 07:58:56
@@ -242,11 +242,10 @@
         }
 
         if (ctx->output_now) {
-            apr_size_t start_index;
             apr_bucket *start_bucket;
             if (ctx->head_start_index > 0) {
                 start_bucket = ctx->head_start_bucket;
-                apr_bucket_split(start_bucket, start_index);
+                apr_bucket_split(start_bucket, ctx->head_start_index);
                 start_bucket = APR_BUCKET_NEXT(start_bucket);
                 ctx->head_start_index = 0;
                 ctx->head_start_bucket = start_bucket;



Reply via email to