diff options
author | Roland McGrath <roland@gnu.org> | 1999-05-09 10:40:36 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1999-05-09 10:40:36 +0000 |
commit | dcc7b756c2e7ccf7fe4f65a533361d8f4bac9653 (patch) | |
tree | 128e6d813179b0cd21a3c8181add3ec1a7e336ce /hurd | |
parent | d656c8cbfe0ef9c232dea81dde8d1fa2b5107def (diff) | |
download | glibc-dcc7b756c2e7ccf7fe4f65a533361d8f4bac9653.tar glibc-dcc7b756c2e7ccf7fe4f65a533361d8f4bac9653.tar.gz glibc-dcc7b756c2e7ccf7fe4f65a533361d8f4bac9653.tar.bz2 glibc-dcc7b756c2e7ccf7fe4f65a533361d8f4bac9653.zip |
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.
Diffstat (limited to 'hurd')
-rw-r--r-- | hurd/get-host.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/hurd/get-host.c b/hurd/get-host.c index f3672ea416..7c55afa0ae 100644 --- a/hurd/get-host.c +++ b/hurd/get-host.c @@ -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'; |