From 745e9e89236324f504aac796c9d3c31e5fc747bf Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Sun, 6 Apr 2014 06:06:53 -0400 Subject: [PATCH] If we encounter read errors reading the duid or iaid after successfully opening the file, print an error and exit. --- ndhc/duiaid.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ndhc/duiaid.c b/ndhc/duiaid.c index 5a4c79f..5d37090 100644 --- a/ndhc/duiaid.c +++ b/ndhc/duiaid.c @@ -175,6 +175,9 @@ void get_clientid(struct client_state_t *cs, struct client_config_t *cc) cc->interface, __func__); } else { iaid_len = safe_read(fd, iaid, sizeof iaid); + if (iaid_len < 0) + suicide("%s: (%s) failed to read IAID from file", + cc->interface, __func__); } close(fd); @@ -188,6 +191,9 @@ void get_clientid(struct client_state_t *cs, struct client_config_t *cc) cc->interface, __func__); } else { duid_len = safe_read(fd, duid, sizeof duid); + if (duid_len < 0) + suicide("%s: (%s) failed to read DUID from file", + cc->interface, __func__); } close(fd);