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
maximilian attems
2011-Dec-01 08:34 UTC
[klibc] [PATCH] ipconfig: check poll() return value
On Wed, Nov 30, 2011 at 03:53:23PM -0800, Greg Thelen wrote:> Check the poll() return value for error before inspecting its output. > > Signed-off-by: Greg Thelen <gthelen at google.com>thanks, looks good to me.