In message <[EMAIL PROTECTED]>, "Andrey A. Chernov" writes:
>I found at least one case:

Try this patch:

Index: malloc.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/stdlib/malloc.c,v
retrieving revision 1.70
diff -u -r1.70 malloc.c
--- malloc.c    30 May 2002 21:59:16 -0000      1.70
+++ malloc.c    9 Aug 2002 07:12:53 -0000
@@ -1093,6 +1093,7 @@
        wrtwarning("recursive call\n");
         malloc_active--;
         THREAD_UNLOCK();
+       errno = EPERM;
        return (0);
     }
     if (!malloc_started)
@@ -1108,6 +1109,8 @@
     THREAD_UNLOCK();
     if (malloc_xmalloc && !r)
        wrterror("out of memory\n");
+    if (!r)
+       errno = ENOMEM;
     return (r);
 }
 
@@ -1120,6 +1123,7 @@
        wrtwarning("recursive call\n");
        malloc_active--;
         THREAD_UNLOCK();
+       errno = EPERM;
        return;
     }
     if (ptr != ZEROSIZEPTR)
@@ -1142,6 +1146,7 @@
        wrtwarning("recursive call\n");
         malloc_active--;
         THREAD_UNLOCK();
+       errno = EPERM;
        return (0);
     }
     if (ptr && !malloc_started) {
@@ -1170,6 +1175,8 @@
     THREAD_UNLOCK();
     if (malloc_xmalloc && err)
        wrterror("out of memory\n");
+    if (err)
+       errno = ENOMEM;
     return (r);
 }
 

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to