diff options
author | Jim Meyering <jim@meyering.net> | 1994-05-19 22:18:30 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1994-05-19 22:18:30 +0000 |
commit | 39bbd361c18f688f72799e280f60d1ba765f6791 (patch) | |
tree | c0c03efcc99c2bc047c9bf00d7edaea458ca071e | |
parent | 5eaba01de64589ca28f43a0a6c2515b30d218521 (diff) | |
download | gnulib-39bbd361c18f688f72799e280f60d1ba765f6791.tar.gz |
GNU shell utilitiesSHELLUTILS-1_10
-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 86408e775d..9973b45bed 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); |