lib: Fix regression in thread.c

* Fix regression introduced with merging of

    'lib: Refactor read/write functionality'
diff --git a/lib/thread.c b/lib/thread.c
index 6608bb1..41c362b 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -790,7 +790,7 @@
   else
     fdset = &m->writefd;
 
-  if (FD_ISSET (fd, &m->readfd))
+  if (FD_ISSET (fd, fdset))
     {
       zlog (NULL, LOG_WARNING, "There is already %s fd [%d]",
 	    (dir = THREAD_READ) ? "read" : "write", fd);