summaryrefslogtreecommitdiff
path: root/hurd/get-host.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 19:31:37 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 19:31:37 +0000
commit74a412373b66a38b6ce8156f027ce26f89a7462f (patch)
treea59ce0af7ffd48641ca9124d697f7a6b57b26931 /hurd/get-host.c
parent2004eeba8fb2a92105bbf95b280fff6dc1d84144 (diff)
parent4cbfda396f7cd9e83116c28965ade73d80c1cb82 (diff)
Merge commit 'refs/top-bases/t/ONSTACK' into t/ONSTACK
Diffstat (limited to 'hurd/get-host.c')
-rw-r--r--hurd/get-host.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hurd/get-host.c b/hurd/get-host.c
index a76ba5c095..2001fc5a86 100644
--- a/hurd/get-host.c
+++ b/hurd/get-host.c
@@ -1,5 +1,5 @@
/* Get a host configuration item kept as the whole contents of a file.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -65,7 +65,7 @@ _hurd_get_host_config (const char *item, char *buf, size_t buflen)
}
/* If the file is empty, give an empty value. */
- if (nread == 0)
+ if (nread == 0 && more == 0)
{
if (buflen != 0)
*buf = '\0';
@@ -80,7 +80,7 @@ _hurd_get_host_config (const char *item, char *buf, size_t buflen)
if (nread < buflen)
buf[nread] = '\0';
else
- if (buf[nread - 1] != '\0')
+ if (nread != 0 && buf[nread - 1] != '\0')
more = 1;
if (more)