You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/11/20 18:24:33 UTC

[PATCH] fix mmap error conditions again

This is from Ben Hyde.  This fixes the "(0)Unknown error: mmap_handler: 
mmap failed" errors on HEAD requests.

Dean

Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_core.c,v
retrieving revision 1.140
diff -u -r1.140 http_core.c
--- http_core.c	1997/11/15 00:16:50	1.140
+++ http_core.c	1997/11/20 17:21:31
@@ -1864,21 +1864,20 @@
     block_alarms();
     if ((r->finfo.st_size >= MMAP_THRESHOLD)
 	&& ( !r->header_only || (d->content_md5 & 1))) {
-      /* we need to protect ourselves in case we die while we've got the
+	/* we need to protect ourselves in case we die while we've got the
  	 * file mmapped */
 	mm = mmap (NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE,
 		    fileno(f), 0);
+	if (mm == (caddr_t)-1) {
+	    aplog_error(APLOG_MARK, APLOG_CRIT, r->server,
+			"default_handler: mmap failed: %s", r->filename);
+	}
     } else {
 	mm = (caddr_t)-1;
     }
 
     if (mm == (caddr_t)-1) {
 	unblock_alarms();
-
-	if (r->finfo.st_size >= MMAP_THRESHOLD) {
-	    aplog_error(APLOG_MARK, APLOG_CRIT, r->server,
-			"mmap_handler: mmap failed: %s", r->filename);
-	}
 #endif
 
 	if (d->content_md5 & 1) {



Re: [PATCH] fix mmap error conditions again

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Thu, Nov 20, 1997 at 09:24:33AM -0800, Dean Gaudet wrote:
> This is from Ben Hyde.  This fixes the "(0)Unknown error: mmap_handler: 
> mmap failed" errors on HEAD requests
+1 too.

    Martin
--
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request