From 8d94580c3deef2f0a303333fff23b5ab4a31da4c Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Thu, 23 Jun 2011 15:59:06 +0200 Subject: [PATCH] parse_leases: exit at read error Signed-off-by: Sami Kerola --- src/getdata.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/getdata.c b/src/getdata.c index 2c5e627..b0a3f5c 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -130,7 +130,9 @@ int parse_leases(void) } while (!feof(dhcpd_leases)) { - fgets(line, MAXLEN, dhcpd_leases); + if (!fgets(line, MAXLEN, dhcpd_leases) && ferror(dhcpd_leases)) { + err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); + } /* It's a lease, save IP */ if (strstr(line, "lease") == line) { strncpy(ipstring, line, (size_t) MAXLEN); -- 1.7.10.4