changeset 14009:872b2da234a3

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>.
author Bruno Haible <bruno@clisp.org>
date Fri, 24 Dec 2010 13:54:16 +0100
parents 8a51d18d6d1e
children fd62a5de1a49
files ChangeLog m4/gethostname.m4
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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.
--- a/m4/gethostname.m4
+++ b/m4/gethostname.m4
@@ -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 @@
 #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
   ])