EAGAIN handling for imsg_read.

Approved by:	bapt (mentor)
Obtained from:	OpenBSD
Differential Revision:	https://reviews.freebsd.org/D4547
This commit is contained in:
araujo 2015-12-15 15:37:58 +00:00
parent ea700ce7e5
commit 99a0984f8b
3 changed files with 7 additions and 5 deletions

View File

@ -172,7 +172,7 @@ client_dispatch_dns(int fd, short events, void *p)
fatalx("unknown event");
if (events & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0)
shut = 1;
@ -275,7 +275,7 @@ client_dispatch_parent(int fd, short events, void *p)
fatalx("unknown event");
if (events & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0)
shut = 1;
@ -377,8 +377,10 @@ ldapclient(int pipe_main2client[2])
bzero(&env, sizeof(env));
TAILQ_INIT(&env.sc_idms);
if ((pw = getpwnam(YPLDAP_USER)) == NULL)
if ((pw = getpwnam(YPLDAP_USER)) == NULL) {
printf("ldapclient.c error\n");
fatal("getpwnam");
}
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_dns) == -1)
fatal("socketpair");

View File

@ -361,7 +361,7 @@ main_dispatch_client(int fd, short events, void *p)
fatalx("unknown event");
if (events & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0)
shut = 1;

View File

@ -140,7 +140,7 @@ dns_dispatch_imsg(int fd, short events, void *p)
fatalx("unknown event");
if (events & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0)
shut = 1;