summaryrefslogtreecommitdiff
path: root/print/a2ps/files/patch-xgethostname.c
blob: 10246118e2529d1b11cc9856436209128fc3e701 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- lib/xgethostname.c.orig	Tue Sep  4 00:51:26 2001
+++ lib/xgethostname.c	Tue Sep  4 00:55:39 2001
@@ -21,6 +21,7 @@
 # include <config.h>
 #endif
 
+#include <sys/param.h>
 #include <sys/types.h>
 
 #include <errno.h>
@@ -38,7 +39,7 @@
 int gethostname ();
 
 #ifndef INITIAL_HOSTNAME_LENGTH
-# define INITIAL_HOSTNAME_LENGTH 34
+# define INITIAL_HOSTNAME_LENGTH MAXHOSTNAMELEN
 #endif
 
 char *
@@ -63,7 +64,7 @@
       if (err == 0 && hostname[k] == '\0')
 	break;
 #ifdef ENAMETOOLONG
-      else if (err != 0 && errno != ENAMETOOLONG && errno != 0)
+      else if (err != 0 && errno != ENAMETOOLONG && errno != ENOMEM && errno != 0)
 	error (EXIT_FAILURE, errno, "gethostname");
 #endif
       size *= 2;