changeset 226:906ef55fec8a

merge with 1.10 + local build mods
author Jim Meyering <jim@meyering.net>
date Fri, 20 May 1994 13:50:55 +0000
parents ef7eee7382c3
children a658d0ce4347
files lib/xgethostname.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/xgethostname.c
+++ b/lib/xgethostname.c
@@ -46,12 +46,12 @@
   int err;
 
   size = INITIAL_HOSTNAME_LENGTH;
+  hostname = xmalloc (size);
   while (1)
     {
-      hostname = xmalloc (size);
       hostname[size - 1] = '\0';
       err = gethostname (hostname, size);
-      if (err || hostname[size - 1] == '\0')
+      if (err == 0 && hostname[size - 1] == '\0')
 	break;
       size *= 2;
       hostname = xrealloc (hostname, size);