浏览代码

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 年前
父节点
当前提交
6abd042ee3
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2
    0
      postsrsd.c

+ 2
- 0
postsrsd.c 查看文件

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

正在加载...
取消
保存