freebsd-dev/lib
Garrett Wollman effcb5eca3 Change gethostname() to set errno to ENAMETOOLONG instead of ENOMEM
when the buffer is not long enough to hold the current host name.
POSIX does not standardize error returns for gethostname(), so it
doesn't matter which one we use, but ENAMETOOLONG is at least a little
more intuitive, and mi suggests the existence of prior art.  I've been
running with this change for a while on my home machine with no
effect.  At the same time, I've updated the prototype for
gethostname() to use the correct standard type (size_t) for the
namelen argument.

All of the in-tree callers fall into one of the following categories:
1) Call perror() or equivalent when gethostname() fails.
2) Ignore gethostname()'s return value entirely, potentially resulting
in data corruption if the buffer is too small.
3) Fall back to a (possibly sensible) default value if gethostname()
fails.

Many of the callers I examined shows signs of confusion about the
correct sizing of the host name buffer.  gethostname(3) now has more
information about this, as well as updated standards information.

PR:		48114
Submitted by:	mi (in part)
2003-08-19 20:38:44 +00:00
..
compat
csu Fix typo: Passing the first argument to exit() in out2 does not work. 2003-07-15 03:50:38 +00:00
libalias style.Makefile(5) 2003-08-18 15:25:39 +00:00
libatm style.Makefile(5) 2003-08-18 15:25:39 +00:00
libbind
libbz2
libc Change gethostname() to set errno to ENAMETOOLONG instead of ENOMEM 2003-08-19 20:38:44 +00:00
libc_r Add wrapper for kqueue() to keep track of the allocated fd and allow it to 2003-07-25 17:02:33 +00:00
libcalendar
libcam Stage 3 of dynamic root support. Make all the libraries needed to run 2003-08-17 08:28:46 +00:00
libcom_err
libcompat Axe AINC. 2003-07-01 15:07:01 +00:00
libcrypt Stage 3 of dynamic root support. Make all the libraries needed to run 2003-08-17 08:28:46 +00:00
libdevinfo
libdevstat style.Makefile(5) 2003-08-18 15:25:39 +00:00
libdisk
libedit style.Makefile(5) 2003-08-18 15:25:39 +00:00
libexpat Stage 3 of dynamic root support. Make all the libraries needed to run 2003-08-17 08:28:46 +00:00
libfetch Some servers respond to RETR in active mode with 125 (connection already 2003-08-19 11:43:11 +00:00
libform
libftpio
libgeom style.Makefile(5) 2003-08-18 15:25:39 +00:00
libio
libipsec style.Makefile(5) 2003-08-18 15:25:39 +00:00
libipx style.Makefile(5) 2003-08-18 15:25:39 +00:00
libisc Fix the #include part of the SYNOPSIS for heap.3 2003-06-17 08:43:19 +00:00
libkse Support printing 64 bits pointer and long integer. 2003-08-19 08:29:33 +00:00
libkvm style.Makefile(5) 2003-08-18 15:25:39 +00:00
libmd style.Makefile(5) 2003-08-18 15:25:39 +00:00
libmenu
libmilter Remove MAINTAINER= lines from individual Makefiles in favor of the 2003-07-07 03:54:04 +00:00
libmp
libncp Fix for 64 bit platforms. sysctl's length args are pointers to 2003-07-25 19:17:46 +00:00
libncurses style.Makefile(5) 2003-08-18 15:25:39 +00:00
libnetgraph
libopie
libpam Revert previous commit after fixing libpam. 2003-07-21 19:56:28 +00:00
libpanel
libpcap
libpthread Support printing 64 bits pointer and long integer. 2003-08-19 08:29:33 +00:00
libradius Add IPv6 related attributes defined in RFC3162. 2003-06-18 17:29:15 +00:00
librpcsvc
libsbuf style.Makefile(5) 2003-08-18 15:25:39 +00:00
libsm Remove MAINTAINER= lines from individual Makefiles in favor of the 2003-07-07 03:54:04 +00:00
libsmb
libsmdb Remove MAINTAINER= lines from individual Makefiles in favor of the 2003-07-07 03:54:04 +00:00
libsmutil Remove MAINTAINER= lines from individual Makefiles in favor of the 2003-07-07 03:54:04 +00:00
libstand bsd.lib.mk,v 1.143 no longer uses ld(1) directly to strip 2003-06-30 19:08:49 +00:00
libtacplus
libtelnet Make sure that a "make release" (more accurately the bit that makes 2003-07-24 17:19:15 +00:00
libthr Implement _get_curthread and _set_curthread. We use GCCs builtin 2003-07-24 07:51:49 +00:00
libufs style.Makefile(5) 2003-08-18 15:25:39 +00:00
libugidfw
libusbhid
libutil style.Makefile(5) 2003-08-18 15:25:39 +00:00
libvgl
libwrap Turn on the extended syntax, which TCP_wrappers has by default, as 2003-07-24 19:58:56 +00:00
libxpg4
liby
libypclnt
libz Stage 3 of dynamic root support. Make all the libraries needed to run 2003-08-17 08:28:46 +00:00
msun Stage 3 of dynamic root support. Make all the libraries needed to run 2003-08-17 08:28:46 +00:00
ncurses style.Makefile(5) 2003-08-18 15:25:39 +00:00
Makefile Imply NOLIBC_R for PowerPC. 2003-08-16 21:21:07 +00:00
Makefile.inc