[klibc] [PATCH] ipconfig: check poll() return value
Greg Thelen
gthelen at google.com
Wed Nov 30 15:53:23 PST 2011
Check the poll() return value for error before inspecting its output.
Signed-off-by: Greg Thelen <gthelen at google.com>
---
usr/kinit/ipconfig/main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
index 8782ae7f..37ca5734 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -408,7 +408,7 @@ static int loop(void)
prev = now;
gettimeofday(&now, NULL);
- if ((fds[0].revents & POLLRDNORM)) {
+ if ((nr > 0) && (fds[0].revents & POLLRDNORM)) {
if (do_pkt_recv(pkt_fd, now.tv_sec) == 1)
break;
}
--
1.7.3.1
More information about the klibc
mailing list