diff options
author | Jim Meyering <jim@meyering.net> | 1994-05-20 13:50:43 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1994-05-20 13:50:43 +0000 |
commit | b98b0e107f67055d20db6005b6dee676a79c06a7 (patch) | |
tree | c8c093359626907c5ed207d60fc5d6811da8e11b /lib | |
parent | a0f30b3f2c9254411cce3cde1639980b623bcb75 (diff) | |
download | coreutils-b98b0e107f67055d20db6005b6dee676a79c06a7.tar.xz |
merge with 1.10 + local build mods
Diffstat (limited to 'lib')
-rw-r--r-- | lib/xgethostname.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); |