apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@clove.org>
Subject Re: mmap bug?
Date Fri, 28 Feb 2003 01:59:35 GMT

On Thursday, February 27, 2003, at 03:32  PM, Justin Erenkrantz wrote:

> --On Thursday, February 27, 2003 23:10:55 +0100 Sander Striker 
> <striker@apache.org> wrote:
>
>> I guess we need to always return APR_EINVAL when a 0 sized mmap is
>> requested.
>
> Would it be valid to return APR_SUCCESS?  Technically, we did map 
> something of zero length.  =)

Not exactly, because it can't be unmapped. :)

IMHO, we should just return APR_EINVAL from apr_mmap_create() if size 
== 0.

--- mmap.c.orig     2003-01-13 00:37:04.000000000 -0800
+++ mmap.c      2003-02-27 17:56:46.000000000 -0800
@@ -122,6 +122,8 @@
      apr_int32_t native_flags = 0;
  #endif

+    if (size == 0)
+        return APR_EINVAL;
      if (file == NULL || file->filedes == -1 || file->buffered)
          return APR_EBADF;
      (*new) = (apr_mmap_t *)apr_pcalloc(cont, sizeof(apr_mmap_t));


-aaron


Mime
View raw message