Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
6abd042ee3
1 değiştirilmiş dosya ile 2 ekleme ve 0 silme
  1. 2
    0
      postsrsd.c

+ 2
- 0
postsrsd.c Dosyayı Görüntüle

@@ -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…
İptal
Kaydet