diff options
author | wollman <wollman@FreeBSD.org> | 2003-08-19 23:01:46 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 2003-08-19 23:01:46 +0000 |
commit | 6e1b7649c8c3561f3a350d01bd1186dc6abf64b5 (patch) | |
tree | 5b436576d8b07d6ddd0812df2201b0d2c7da9912 /lib/libc/gen/gethostname.c | |
parent | 1c1194250d59edd49cfbc3438c6e16a732403a44 (diff) | |
download | FreeBSD-src-6e1b7649c8c3561f3a350d01bd1186dc6abf64b5.zip FreeBSD-src-6e1b7649c8c3561f3a350d01bd1186dc6abf64b5.tar.gz |
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
Diffstat (limited to 'lib/libc/gen/gethostname.c')
-rw-r--r-- | lib/libc/gen/gethostname.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/gen/gethostname.c b/lib/libc/gen/gethostname.c index 37b52ca..acc3386 100644 --- a/lib/libc/gen/gethostname.c +++ b/lib/libc/gen/gethostname.c @@ -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) { |