TLS: track changing fd of file-watcher when creds are releaded.
[exim.git] / src / src / daemon.c
index b088e3491e02a6feb300434bb095759827770823..a4b1e2685451633f8480c928a59c1977d037648b 100644 (file)
@@ -2462,7 +2462,14 @@ for (;;)
 
 #ifndef DISABLE_TLS
       /* Create or rotate any required keys; handle (delayed) filewatch event */
-      tls_daemon_tick();
+      for (int old_tfd = tls_daemon_tick(); old_tfd >= 0; )
+       {
+       FD_CLR(old_tfd, &select_listen);
+       if (old_tfd == listen_fd_max - 1) listen_fd_max = old_tfd;
+       if (tls_watch_fd >= 0)
+         add_listener_socket(tls_watch_fd, &select_listen, &listen_fd_max);
+       break;
+       }
 #endif
       errno = select_errno;
       }