This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: test-netdb.c


> The documented behavior is not what POSIX says and not what Linux (the
> kernel) implements.

Nonetheless it is the documentation and actual behavior of the GNU C
library, at least on the original Linux/x86 and Hurd/x86 platforms.  The
library's documentation and behavior predate any standard specifying
`gethostname' (I mean true public standards, excluding any single-vendor
specifications like SVR4).  I made the test consistent with all of that.
If we are going to change the specification of `gethostname' from the one
we have had for numerous years, we should consistently change it everywhere.

The draft 7 Open Group spec seems to say that gethostname should truncate
the result and return zero when the given buffer length is too short.  That
means the only robust way to get the whole hostname when HOST_NAME_MAX is
unlimited is to check the result and stop enlarging the buffer when the
result's strlen is less than bufsize-1.  I don't have a problem with that,
but it is an incompatible change and could break programs that expect the
ENAMETOOLONG behavior.  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]