Sfoglia il codice sorgente

Merge pull request #16 from crispygoth/master

A couple of small fixes: closing listen sockets in child and ignoring EINTR errors from main poll
tags/1.2
Timo Röhling 10 anni fa
parent
commit
174337768c
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6
    0
      postsrsd.c

+ 6
- 0
postsrsd.c Vedi File

@@ -420,6 +420,8 @@ int main (int argc, char **argv)
420 420
     char keybuf[1024], *key;
421 421
 
422 422
     if (poll(fds, 2, 1000) < 0) {
423
+      if (errno == EINTR)
424
+        continue;
423 425
       if (daemonize)
424 426
         syslog (LOG_MAIL | LOG_ERR, "Poll failure: %s", strerror(errno));
425 427
       else
@@ -431,6 +433,10 @@ int main (int argc, char **argv)
431 433
         conn = accept(fds[i].fd, NULL, NULL);
432 434
         if (conn < 0) continue;
433 435
         if (fork() == 0) {
436
+          // close listen sockets so that we don't stop the main daemon process from restarting
437
+          close(forward_sock);
438
+          close(reverse_sock);
439
+
434 440
           fp = fdopen(conn, "r+");
435 441
           if (fp == NULL) exit(EXIT_FAILURE);
436 442
           fds[2].fd = conn;

Loading…
Annulla
Salva