Re: malloc failure and errno

2007-09-09 Thread Roland McGrath
> What is the reason? Can malloc() return NULL with errno being set to something > different than ENOMEM? It is probably just overly-conservative code in those callers.

Re: malloc failure and errno

2007-09-09 Thread Bruno Haible
Jim Meyering wrote: > POSIX guarantees that errno is defined when malloc or realloc > fails, so there's no need to set it manually in that case. Yet glibc does set it manually in some cases: glibc-2.6.1/login/openpty.c:69 glibc-2.6.1/login/login.c:67 glibc-2.6.1/stdlib/setenv.c:180 glibc-2.6.1/sy