Martin Pohlack ([EMAIL PROTECTED]) wrote: > In my recent attempt to build kaffe with the "diet libc" I noticed some > #warnings, given by "diet libc": > > ../kaffevm/.libs/libkaffevm.a(syscalls.o)(.text+0x4e8): In function > `jthreadedGetHostByAddr': > /home/mp26/erwin/kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:270: > warning: gethostbyaddr() leaks memory. Use gethostbyaddr_r instead! > ../kaffevm/.libs/libkaffevm.a(syscalls.o)(.text+0x493): In function > `jthreadedGetHostByName': > /home/mp26/erwin/kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:251: > warning: gethostbyname() leaks memory. Use gethostbyname_r instead!
Maybe diet libc's implementation does. In OpenBSD and most other Unix systems, gethostbyname() uses a static buffer which is returned (or a pointer to which is returned) every time. This means it's not safe to use in multi-threaded apps. Kaffe's aware of this, as you can see by the comments, so they lock the whole thing while it's doing a name lookup. OpenBSD doesn't have the *_r versions. -- Greg Wooledge | "Truth belongs to everybody." [EMAIL PROTECTED] | - The Red Hot Chili Peppers http://wooledge.org/~greg/ |
pgp00000.pgp
Description: PGP signature