This is the mail archive of the libc-alpha@sourceware.org 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: malloc failure and errno


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/sysdeps/unix/grantpt.c:82

What is the reason? Can malloc() return NULL with errno being set to something
different than ENOMEM?

Bruno


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