info: write_data: do not add invalid sockets to the FD set
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 2 Dec 2015 11:59:46 +0000 (12:59 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 2 Dec 2015 19:54:17 +0000 (20:54 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/info/olsrd_info.c

index 4866aa7..f102d94 100644 (file)
@@ -159,6 +159,10 @@ static void write_data(void *foo __attribute__ ((unused))) {
   FD_ZERO(&set);
   max = 0;
   for (i = 0; i < outbuffer.count; i++) {
+    if (outbuffer.socket[i] < 0) {
+      continue;
+    }
+
     /* And we cast here since we get a warning on Win32 */
     FD_SET((unsigned int ) (outbuffer.socket[i]), &set);