From: Roland McGrath Date: Sun, 9 May 1999 10:40:36 +0000 (+0000) Subject: 1999-05-09 Mark Kettenis X-Git-Tag: cvs/glibc-2_1_1~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dcc7b756c2e7ccf7fe4f65a533361d8f4bac9653;p=thirdparty%2Fglibc.git 1999-05-09 Mark Kettenis * hurd/get-host.c (_hurd_get_host_config): Return an empty value if the file is empty. --- diff --git a/hurd/get-host.c b/hurd/get-host.c index f3672ea416c..7c55afa0aee 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';