mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-12 14:21:18 +08:00
1999-05-09 Mark Kettenis <kettenis@gnu.org>
* hurd/get-host.c (_hurd_get_host_config): Return an empty value if the file is empty.
This commit is contained in:
parent
d656c8cbfe
commit
dcc7b756c2
@ -63,6 +63,14 @@ _hurd_get_host_config (const char *item, char *buf, size_t buflen)
|
||||
__vm_deallocate (__mach_task_self (), (vm_address_t) data, nread);
|
||||
}
|
||||
|
||||
/* If the file is empty, give an empty value. */
|
||||
if (nread == 0)
|
||||
{
|
||||
if (buflen != 0)
|
||||
*buf = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Remove newlines in case someone wrote the file by hand. */
|
||||
while (buf[nread - 1] == '\n')
|
||||
buf[--nread] = '\0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user