This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: calloc fix on branch build failure


On Thu, Aug 08, 2002 at 10:46:48PM +1000, Greg Schafer wrote:
> Hope I didn't stuff up..
> 
> Applied the patch to 2.2.5 and compiling with gcc-3.1.1
> I get:-
> 
> make[2]: Entering directory `/usr/src/glibc-2.2.5/malloc'
> gcc malloc.c -c -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g   -DMORECORE_CLEARS=2   -I../include -I. -I/usr/src/g
> malloc.c:1887: warning: weak declaration of `__malloc_initialize_hook' after first use results in unspecified behavior
> malloc.c:1889: warning: weak declaration of `__free_hook' after first use results in unspecified behavior
> malloc.c:1891: warning: weak declaration of `__malloc_hook' after first use results in unspecified behavior
> malloc.c:1894: warning: weak declaration of `__realloc_hook' after first use results in unspecified behavior
> malloc.c:1897: warning: weak declaration of `__memalign_hook' after first use results in unspecified behavior
> malloc.c: In function `__libc_calloc':
> malloc.c:3811: `MALLOC_FAILURE_ACTION' undeclared (first use in this function)
> malloc.c:3811: (Each undeclared identifier is reported only once
> malloc.c:3811: for each function it appears in.)
> make[2]: *** [/usr/src/glibc-build/malloc/malloc.o] Error 1
> make[2]: Leaving directory `/usr/src/glibc-2.2.5/malloc'
> make[1]: *** [malloc/subdir_lib] Error 2
> make[1]: Leaving directory `/usr/src/glibc-2.2.5'
> make: *** [install] Error 2

MALLOC_FAILURE_ACTION is not valid for glibc-2-2-branch, please correct it
with smth like this:
--- malloc/malloc.c.orig
+++ malloc/malloc.c
@@ -3808,7 +3808,7 @@
   (((INTERNAL_SIZE_T) 1) << (8 * sizeof (INTERNAL_SIZE_T) / 2))
   if (__builtin_expect ((n | elem_size) >= HALF_INTERNAL_SIZE_T, 0)) {
     if (elem_size != 0 && bytes / elem_size != n) {
-      MALLOC_FAILURE_ACTION;
+      __set_errno (ENOMEM);
       return 0;
     }
   }


--
ldv

Attachment: msg00022/pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]