Test for overflowing platform FD_SET size.
diff --git a/src/util.c b/src/util.c
index 9299703..59ea518 100644
--- a/src/util.c
+++ b/src/util.c
@@ -570,10 +570,23 @@
   return buff;
 }
 
-void bump_maxfd(int fd, int *max)
+void bump_maxfd(fd_set *set, int fd, int *max)
 {
-  if (fd > *max)
-    *max = fd;
+#ifdef FD_SETSIZE
+  if (fd >= FD_SETSIZE)
+    {
+      static int logged = 0;
+      if (!logged)
+	my_syslog(LOG_ERR, _("File descriptor overflows FS_SET"));
+      logged = 1;
+    }
+  else
+ #endif
+    {
+      FD_SET(fd, set);
+      if (fd > *max)
+	*max = fd;
+    }
 }
 
 /* rc is return from sendto and friends.