about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-07-07 15:33:09 +0000
committerUlrich Drepper <drepper@redhat.com>1999-07-07 15:33:09 +0000
commit9ae6fc542a6267377078f1c64f45bc9bd2a96da5 (patch)
tree1f06aedd825ee8a64050e334e1aedb18ee9ba9e1
parent597d10a00a66955a0f3998e265eaa2d100d5b876 (diff)
downloadglibc-9ae6fc542a6267377078f1c64f45bc9bd2a96da5.tar.gz
glibc-9ae6fc542a6267377078f1c64f45bc9bd2a96da5.tar.xz
glibc-9ae6fc542a6267377078f1c64f45bc9bd2a96da5.zip
Update.
	* malloc/malloc.c (request2size): Also set errno of failing.
-rw-r--r--ChangeLog2
-rw-r--r--malloc/malloc.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 37e91a4653..8cf3f3da29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 1999-07-07  Ulrich Drepper  <drepper@cygnus.com>
 
+	* malloc/malloc.c (request2size): Also set errno of failing.
+
 	* malloc/malloc.c (request2size): Take care of overflow in
 	addition.
 
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 09085e81ad..86f25d5184 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -822,6 +822,10 @@ do {                                                                          \
    computed. */
 
 
+/* Macro to set errno.  */
+#ifndef __set_errno
+# define __set_errno(val) errno = (val)
+#endif
 
 /* On some platforms we can compile internal, not exported functions better.
    Let the environment provide a macro and define it to be empty if it
@@ -1264,7 +1268,8 @@ static void      free_atfork();
 #define request2size(req, nb) \
  ((nb = (req) + (SIZE_SZ + MALLOC_ALIGN_MASK)),\
   ((long)nb <= 0 || nb < (INTERNAL_SIZE_T) (req) \
-   ? 1 : ((nb < (MINSIZE + MALLOC_ALIGN_MASK) \
+   ? (__set_errno (ENOMEM), 1) \
+   : ((nb < (MINSIZE + MALLOC_ALIGN_MASK) \
 	   ? (nb = MINSIZE) : (nb &= ~MALLOC_ALIGN_MASK)), 0)))
 
 /* Check if m has acceptable alignment */