Return-Path: Mailing-List: contact bugs-help@httpd.apache.org; run by ezmlm Delivered-To: mailing list bugs@httpd.apache.org Received: (qmail 95579 invoked from network); 19 Mar 2002 18:35:46 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 19 Mar 2002 18:35:46 -0000 Received: (qmail 13789 invoked by uid 50); 19 Mar 2002 18:03:05 -0000 Date: 19 Mar 2002 18:03:05 -0000 Message-ID: <20020319180305.13787.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: bugs@httpd.apache.org Cc: Subject: DO NOT REPLY [Bug 7252] New: - Should fopen() in this example really be ap_pfopen ()? X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7252 Should fopen() in this example really be ap_pfopen ()? Summary: Should fopen() in this example really be ap_pfopen ()? Product: Apache httpd-1.3 Version: 1.3.23 Platform: All URL: http://httpd.apache.org/docs/misc/API.html#resp_handlers OS/Version: All Status: NEW Severity: Minor Priority: Other Component: Documentation AssignedTo: bugs@httpd.apache.org ReportedBy: bernard.l.dubreuil@erdc.usace.army.mil Maybe this is obvious to the experienced Apache programmer but in this example why is fopen() used to open the file and ap_pfclose() used to close it? int default_handler (request_rec *r) { int errstatus; FILE *f; if (r->method_number != M_GET) return DECLINED; if (r->finfo.st_mode == 0) return NOT_FOUND; if ((errstatus = ap_set_content_length (r, r->finfo.st_size)) || (errstatus = ap_set_last_modified (r, r->finfo.st_mtime))) return errstatus; f = fopen (r->filename, "r"); if (f == NULL) { log_reason("file permissions deny server access", r->filename, r); return FORBIDDEN; } register_timeout ("send", r); ap_send_http_header (r); if (!r->header_only) send_fd (f, r); ap_pfclose (r->pool, f); return OK; }