Calling FD_SET() in between return of select() and call to FD_ISSET() effectively renders the whole thing useless: FD_ISSET() will always return true no matter what select() actually did. Fixes: a72315d2bad47 ("src: add rule batching support") Signed-off-by: Phil Sutter <phil@xxxxxx> --- src/mnl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mnl.c b/src/mnl.c index f6363560721c1..492d7517d40e2 100644 --- a/src/mnl.c +++ b/src/mnl.c @@ -300,12 +300,12 @@ int mnl_batch_talk(struct netlink_ctx *ctx, struct list_head *err_list) err = -1; } + FD_ZERO(&readfds); + FD_SET(fd, &readfds); + ret = select(fd+1, &readfds, NULL, NULL, &tv); if (ret == -1) return -1; - - FD_ZERO(&readfds); - FD_SET(fd, &readfds); } return err; } -- 2.21.0