gethostname: Provide a fallback for HOST_NAME_MAX.
authorBruno Haible <bruno@clisp.org>
Fri, 24 Dec 2010 12:54:16 +0000 (13:54 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 24 Dec 2010 12:54:16 +0000 (13:54 +0100)
* m4/gethostname.m4 (gl_FUNC_GETHOSTNAME): When neither HOST_NAME_MAX
nor MAXHOSTNAMELEN is found in the usual system headers, use 256
instead.
Reported by Joachim Schmitz <jojo@schmitz-digital.de>.

ChangeLog
m4/gethostname.m4

index fb92f85..9e4c4e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-12-24  Bruno Haible  <bruno@clisp.org>
 
+       gethostname: Provide a fallback for HOST_NAME_MAX.
+       * m4/gethostname.m4 (gl_FUNC_GETHOSTNAME): When neither HOST_NAME_MAX
+       nor MAXHOSTNAMELEN is found in the usual system headers, use 256
+       instead.
+       Reported by Joachim Schmitz <jojo@schmitz-digital.de>.
+
+2010-12-24  Bruno Haible  <bruno@clisp.org>
+
        sigaction tests: Allow missing SA_RESETHAND and SA_RESTART.
        * tests/test-sigaction.c (SA_RESETHAND): Fall back to 0.
        (SA_RESTART): Likewise.
index ef0b43e..025c55d 100644 (file)
@@ -1,5 +1,5 @@
-# gethostname.m4 serial 9
-dnl Copyright (C) 2002, 2008, 2009, 2010 Free Software Foundation, Inc.
+# gethostname.m4 serial 10
+dnl Copyright (C) 2002, 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -83,7 +83,11 @@ lucky
 #if HAVE_NETDB_H
 # include <netdb.h>
 #endif
-])
+],
+          [dnl The system does not define MAXHOSTNAMELEN in any of the common
+           dnl headers. Use a safe fallback.
+           gl_cv_decl_HOST_NAME_MAX=256
+          ])
       fi
     fi
   ])