]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Declare gethostname for XPG4 (bug 20054).
authorJoseph Myers <joseph@codesourcery.com>
Thu, 12 May 2016 16:50:43 +0000 (16:50 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 12 May 2016 16:50:43 +0000 (16:50 +0000)
unistd.h declares gethostname for __USE_UNIX98 || __USE_XOPEN2K.  But
it's also in XPG4 (XNS volume - C438 - not the main definitions of
system interfaces and headers in C435).  This patch corrects the
condition.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

[BZ #20054]
* posix/unistd.h (gethostname): Declare if [__USE_XOPEN_EXTENDED],
not [__USE_UNIX98].
* conform/data/unistd.h-data (gethostname): Do not expect for
[XPG3].

ChangeLog
conform/data/unistd.h-data
posix/unistd.h

index b85a2938ea194840b02a4cee4754b115d3e5ffe3..fe723a609b3ca101bb0f53c57320e84cf6fcef35 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2016-05-12  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #20054]
+       * posix/unistd.h (gethostname): Declare if [__USE_XOPEN_EXTENDED],
+       not [__USE_UNIX98].
+       * conform/data/unistd.h-data (gethostname): Do not expect for
+       [XPG3].
+
        * conform/data/fcntl.h-data [!POSIX] (S_IFMT): Do not expect.
        [!POSIX] (S_IFBLK): Likewise.
        [!POSIX] (S_IFCHR): Likewise.
index 9c00d44551e47b989d644e51f8ad8faaa7def09f..5958ff700cbfccfa74b577df573b4e9c50c001d9 100644 (file)
@@ -490,7 +490,7 @@ function int getgroups (int, gid_t[])
 #if !defined POSIX && !defined POSIX2008
 function long gethostid (void)
 #endif
-#if !defined POSIX
+#if !defined POSIX && !defined XPG3
 function int gethostname (char*, size_t)
 #endif
 function {char*} getlogin (void)
index 7486ecf4a97f9c7880de3b0208edf817ba2220b2..98ffcea649c6e2a18b086dbdb932dbf7ee396df3 100644 (file)
@@ -875,7 +875,7 @@ extern int setlogin (const char *__name) __THROW __nonnull ((1));
 #endif
 
 
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
 /* Put the name of the current host in no more than LEN bytes of NAME.
    The result is null-terminated if LEN is large enough for the full
    name and the terminator.  */