>Number: 5694 >Category: general >Synopsis: Startup problems - unchecked return value - when FD_SETSIZE >not large enough >Confidential: no >Severity: serious >Priority: medium >Responsible: apache >State: open >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Thu Feb 03 09:10:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: [EMAIL PROTECTED] >Release: 1.3.9 >Organization: apache >Environment: FreeBSD 3.3-RELEASE (rest not relevant - patch information included) >Description: In src/main/http_main.c setup_listeners() there is a call to make_sock(). The return value is unchecked. make_sock can return -1 in certain circumstances. Have seen this if FD_SETSIZE is too small.
Result: apache complains about FD_SETSIZE (elsewhere), but continues in its attempt to startup. Keeps fork()ing and these children keep failing, because they attempt to perform socket operations on fd -1. >How-To-Repeat: Perhaps by setting FD_SETSIZE to a small value in 'apaci' and compiling? >Fix: My amendment was to change part of setup_listeners() so that it checks the return value of make_sock(). I can accept that the exit value is a little arbitrary: fd = make_sock(p, &lr->local_addr); if (fd == -1) { /* [ this was my work mail address ] */ ap_log_error(APLOG_MARK, APLOG_EMERG, NULL, "Failed to create the socket to listen on, " "(attempt was for port %d)", ntohs(lr->local_addr.sin_po rt)); exit(42); } >Release-Note: >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, you need] [to include <[EMAIL PROTECTED]> in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]