Repository navigation
cpnet: use gethostbyname_r() only when its declaration is known - #74
duncanmcqueen wants to merge 1 commit into
Conversation
On Haiku, gethostbyname_r() is in libnetwork but no header declares it, so configure finds the function but not the number of arguments, and cpnet.c stops with #error. Use gethostbyname() in that case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: duncanmcqueen <dwmcqueen@gmail.com>
|
Hi @duncanmcqueen , If possible, when a PR falls behind master, prefer rebasing it rather than merging master into it, this makes it easier to keep a linear history :-) |
08d2f17 to
c4e3f02
Compare
|
I am looking into this but I am not sure this is the right fix, for two reasons:
We're looking into possible alternatives; will come back to you. |
|
Please have a look at #76. This switches to |
|
Thank you. #76 is now merged. |
Split from #60.
Problem and fix
configurechecks ifgethostbyname_r()exists (HAVE_GETHOSTBYNAME_R), and then how many arguments it takes (HAVE_FUNC_GETHOSTBYNAME_R_6,_5or_3). The second check reads the declaration in<netdb.h>.On Haiku,
libnetworkhasgethostbyname_r(), but no header declares it. Thus the first check finds the function and the second check fails. Thencpnet.cstops with#error unknown number of arguments for gethostbyname_r.Now
cpnet.cusesgethostbyname_r()only if configure found the number of arguments. Otherwise it usesgethostbyname(), as it does when the function does not exist.The first check finds the function only when
libnetworkis inLIBS, which #73 does. Thus the error occurs on Haiku after #73, not withmasteralone. Please merge this pull request before #73 or together with it.How to reproduce
On Haiku, with #73:
Results
Haiku R1/beta6 x86_64 (hrev59866),
javacfrom OpenJDK 8, Kaffe 1.1.10-pre. I ranautoreconfon Linux (autoconf 2.73, automake 1.19) and built on Haiku out of tree with--enable-jni --disable-examples --disable-plugin --disable-gjdoc --disable-gtk-peer --disable-gconf-peer --disable-alsa --disable-dssi.Platforms
Not specific to Haiku: it occurs on each system that has
gethostbyname_r()in its libraries but does not declare it. Haiku is the system that I know. On Linux, configure giveschecking for library containing inet_pton... none requiredandchecking how many arguments gethostbyname_r() takes... six, so the result does not change on Linux.AI assistance
An AI model (Claude Code, by Anthropic) wrote this change, the test and this text. The repository owner directed the work and checked the results. Please review it as you review other contributions.
🤖 Generated with Claude Code