Browse Source

Ignore EINTR errors from main poll() loop

When trying to connect the strace tool to the daemon's main process, the
daemon would die because strace interrupted the poll() causing it to
return EINTR.

It should be safe to ignore EINTR errors from poll in this case. Either
the received signal will be otherwise ignored by the process, or it will
cause it to terminate.
tags/1.2
Chris Butler 10 years ago
parent
commit
6abd042ee3
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      postsrsd.c

+ 2
- 0
postsrsd.c View File

420
     char keybuf[1024], *key;
420
     char keybuf[1024], *key;
421
 
421
 
422
     if (poll(fds, 2, 1000) < 0) {
422
     if (poll(fds, 2, 1000) < 0) {
423
+      if (errno == EINTR)
424
+        continue;
423
       if (daemonize)
425
       if (daemonize)
424
         syslog (LOG_MAIL | LOG_ERR, "Poll failure: %s", strerror(errno));
426
         syslog (LOG_MAIL | LOG_ERR, "Poll failure: %s", strerror(errno));
425
       else
427
       else

Loading…
Cancel
Save