Bug 46412 - make_child return value not checked
Summary: make_child return value not checked
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mpm_prefork (show other bugs)
Version: 2.4-HEAD
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2008-12-17 16:00 UTC by Brian McQueen
Modified: 2015-04-13 16:52 UTC (History)
0 users



Attachments
checking return value of make_child (725 bytes, patch)
2008-12-17 21:55 UTC, Brian McQueen
Details | Diff
checking return value of make_child() (2.13 KB, patch)
2015-04-13 16:50 UTC, thekevinday
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian McQueen 2008-12-17 16:00:00 UTC
There are instances in prefork.c where make_child's return value is not checked, but the counter is decremented anyway:

                    make_child(ap_server_conf, child_slot);
                    --remaining_children_to_start;
Comment 1 Brian McQueen 2008-12-17 21:55:12 UTC
Created attachment 23036 [details]
checking return value of make_child
Comment 2 thekevinday 2015-04-13 16:50:50 UTC
Created attachment 32645 [details]
checking return value of make_child()

make_child()'s return value is still not checked even with httpd-2.4.

This also affects all these three workers:
- event
- prefork
- worker

Looking at httpd-2.4, the return value for make_child() appears to return 0 when there is no failure.

I suggest:
    if (make_child(ap_server_conf, child_slot) >= 0) {
       --remaining_children_to_start;
    }

Instead of:
    if (make_child(ap_server_conf, child_slot) > 0) {
       --remaining_children_to_start;
    }

because in the case of a return value of 0, the remaining_children_to_start should still be decremented.