Bruno Haible <[EMAIL PROTECTED]> writes:

> Simon Josefsson wrote:
>> @@ -21,6 +21,8 @@
>>  
>>  #ifdef HAVE_UNAME
>>  # include <sys/utsname.h>
>> +#else
>> +# include <string.h>
>>  #endif
>>  
>>  /* Put up to LEN chars of the host name into NAME.
>
> While at it, you could make the patch complete: The function strncpy also
> needs to be declared somewhere.

Good point.  Patch below applied.

/Simon

diff --git a/ChangeLog b/ChangeLog
index 467fadb..776e8ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-17  Simon Josefsson  <[EMAIL PROTECTED]>
+
+       * lib/gethostname.c: Include string.h unconditionally, strncpy is
+       used by the UNAME case.  Reported by Bruno Haible
+       <[EMAIL PROTECTED]>.
+
 2008-01-17  Eric Blake  <[EMAIL PROTECTED]>
 
        Convert c-strcasestr to be more efficient.
diff --git a/lib/gethostname.c b/lib/gethostname.c
index de3d9a5..169dd4e 100644
--- 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.  */


Reply via email to