* hurd/get-host.c (_hurd_get_host_config): Also check that more == 0
before assuming that the file is empty. Avoid testing buffer content
when nread == 0.
+2017-09-07 Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+ * hurd/get-host.c (_hurd_get_host_config): Also check that more == 0
+ before assuming that the file is empty. Avoid testing buffer content
+ when nread == 0.
+
2017-09-06 Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #18858]
}
/* If the file is empty, give an empty value. */
- if (nread == 0)
+ if (nread == 0 && more == 0)
{
if (buflen != 0)
*buf = '\0';
if (nread < buflen)
buf[nread] = '\0';
else
- if (buf[nread - 1] != '\0')
+ if (nread != 0 && buf[nread - 1] != '\0')
more = 1;
if (more)