changeset 9631:e225fe0e35c0

Need string.h unconditionally, for strncpy or strcpy.
author Simon Josefsson <simon@josefsson.org>
date Thu, 17 Jan 2008 11:07:41 +0100
parents 729b6d4ffac1
children 2afb25a39ffb
files ChangeLog lib/gethostname.c
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-17  Simon Josefsson  <simon@josefsson.org>
+
+	* lib/gethostname.c: Include string.h unconditionally, strncpy is
+	used by the UNAME case.  Reported by Bruno Haible
+	<bruno@clisp.org>.
+
 2008-01-17  Eric Blake  <ebb9@byu.net>
 
 	Convert c-strcasestr to be more efficient.
--- a/lib/gethostname.c
+++ b/lib/gethostname.c
@@ -21,10 +21,10 @@
 
 #ifdef HAVE_UNAME
 # include <sys/utsname.h>
-#else
-# include <string.h>
 #endif
 
+#include <string.h>
+
 /* Put up to LEN chars of the host name into NAME.
    Null terminate it if the name is shorter than LEN.
    Return 0 if ok, -1 if error.  */