projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Indent nested CPP-directives.
[gnulib.git]
/
lib
/
xgethostname.c
diff --git
a/lib/xgethostname.c
b/lib/xgethostname.c
index
86408e7
..
216e78b
100644
(file)
--- a/
lib/xgethostname.c
+++ b/
lib/xgethostname.c
@@
-18,14
+18,7
@@
/* Written by Jim Meyering, meyering@comco.com */
#ifdef HAVE_CONFIG_H
/* Written by Jim Meyering, meyering@comco.com */
#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
#include <config.h>
-#else
-#include "config.h"
-#endif
#endif
#include <sys/types.h>
#endif
#include <sys/types.h>
@@
-46,12
+39,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);