projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GNU shell utilities
[gnulib.git]
/
lib
/
xgethostname.c
diff --git
a/lib/xgethostname.c
b/lib/xgethostname.c
index
86408e7
..
9973b45
100644
(file)
--- a/
lib/xgethostname.c
+++ b/
lib/xgethostname.c
@@
-46,12
+46,12
@@
xgethostname ()
int err;
size = INITIAL_HOSTNAME_LENGTH;
int err;
size = INITIAL_HOSTNAME_LENGTH;
+ hostname = xmalloc (size);
while (1)
{
while (1)
{
- hostname = xmalloc (size);
hostname[size - 1] = '\0';
err = gethostname (hostname, 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);
break;
size *= 2;
hostname = xrealloc (hostname, size);