summaryrefslogtreecommitdiffstats
path: root/contrib/tcl/unix/tclUnixSock.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tcl/unix/tclUnixSock.c')
-rw-r--r--contrib/tcl/unix/tclUnixSock.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/contrib/tcl/unix/tclUnixSock.c b/contrib/tcl/unix/tclUnixSock.c
index 4301889..b917832 100644
--- a/contrib/tcl/unix/tclUnixSock.c
+++ b/contrib/tcl/unix/tclUnixSock.c
@@ -8,21 +8,38 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * SCCS: @(#) tclUnixSock.c 1.6 96/08/08 08:48:51
+ * SCCS: @(#) tclUnixSock.c 1.7 97/07/24 17:54:02
*/
#include "tcl.h"
#include "tclPort.h"
/*
- * The following variable holds the network name of this host.
+ * There is no portable macro for the maximum length
+ * of host names returned by gethostbyname(). We should only
+ * trust SYS_NMLN if it is at least 255 + 1 bytes to comply with DNS
+ * host name limits.
+ *
+ * Note: SYS_NMLN is a restriction on "uname" not on gethostbyname!
+ *
+ * For example HP-UX 10.20 has SYS_NMLN == 9, while gethostbyname()
+ * can return a fully qualified name from DNS of up to 255 bytes.
+ *
+ * Fix suggested by Viktor Dukhovni (viktor@esm.com)
*/
-#ifndef SYS_NMLN
-# define SYS_NMLN 100
+#if defined(SYS_NMLN) && SYS_NMLEN >= 256
+#define TCL_HOSTNAME_LEN SYS_NMLEN
+#else
+#define TCL_HOSTNAME_LEN 256
#endif
-static char hostname[SYS_NMLN + 1];
+
+/*
+ * The following variable holds the network name of this host.
+ */
+
+static char hostname[TCL_HOSTNAME_LEN + 1];
static int hostnameInited = 0;
/*
OpenPOWER on IntegriCloud