Add a kluge suggested by Marcel to paper over the difference between

gethostname()'s old and new signatures without requiring a library
bump.  Note that programs which called gethostname() with a negative
argument were already broken, since the same type conversion was done
by the old implementation.  Add a note in the Makefile so that whoever
next bumps the libc revision will delete the kluge at the same time
(as it will no longer be necessary).  This is only operative on 64-bit
platforms.

Submitted by:	marcel
This commit is contained in:
wollman 2003-08-19 23:01:46 +00:00
parent 1c1194250d
commit 6e1b7649c8
2 changed files with 4 additions and 0 deletions

View File

@ -9,6 +9,7 @@
# (for system call stubs) to CFLAGS below. -DSYSLIBC_SCCS affects just the
# system call stubs.
LIB=c
# If you bump SHLIB_MAJOR, remove kluge from gen/gethostname.c.
SHLIB_MAJOR= 5
SHLIBDIR?= /lib
CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include

View File

@ -49,6 +49,9 @@ gethostname(name, namelen)
{
int mib[2];
/* Kluge to avoid ABI breakage. */
namelen = (int)namelen;
mib[0] = CTL_KERN;
mib[1] = KERN_HOSTNAME;
if (sysctl(mib, 2, name, &namelen, NULL, 0) == -1) {