From 76f7cecea183676bb061f433ba33eb351f1f5ffe Mon Sep 17 00:00:00 2001 From: Hemanth Thummala Date: Tue, 10 Feb 2015 13:31:22 -0800 Subject: [PATCH] Signed-off-by: Hemanth Thummala Handle POLLNVAL while reading from winbindd socket. This will avoid going into infinite poll loop when the supplied fd is invalid or closed. --- nsswitch/wb_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c index 5fde8d0..45908c3 100644 --- a/nsswitch/wb_common.c +++ b/nsswitch/wb_common.c @@ -455,6 +455,7 @@ static int winbind_read_sock(void *buffer, int count) pfd.fd = fd; pfd.events = POLLIN|POLLHUP; + pfd.revents = 0; /* Wait for 5 seconds for a reply. May need to parameterise this... */ @@ -475,7 +476,7 @@ static int winbind_read_sock(void *buffer, int count) continue; } - if ((ret == 1) && (pfd.revents & (POLLIN|POLLHUP|POLLERR))) { + if ((ret == 1) && (pfd.revents & (POLLIN|POLLHUP|POLLERR|POLLNVAL))) { /* Do the Read */ -- 1.8.2