From: Jim Meyering Date: Fri, 20 May 1994 13:50:55 +0000 (+0000) Subject: merge with 1.10 + local build mods X-Git-Tag: cvs-readonly~8897 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=789070f68be27d11c93d5792c14ba9d830cbfa08;p=gnulib.git merge with 1.10 + local build mods --- diff --git a/lib/xgethostname.c b/lib/xgethostname.c index 86408e775..9973b45be 100644 --- a/lib/xgethostname.c +++ b/lib/xgethostname.c @@ -46,12 +46,12 @@ xgethostname () 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);