Explorar el Código

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 hace 10 años
padre
commit
6abd042ee3
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2
    0
      postsrsd.c

+ 2
- 0
postsrsd.c Ver fichero

@@ -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

Loading…
Cancelar
Guardar