Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Dec 2015 15:37:58 +0000 (UTC)
From:      Marcelo Araujo <araujo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292270 - head/usr.sbin/ypldap
Message-ID:  <201512151537.tBFFbw36080768@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: araujo
Date: Tue Dec 15 15:37:58 2015
New Revision: 292270
URL: https://svnweb.freebsd.org/changeset/base/292270

Log:
  EAGAIN handling for imsg_read.
  
  Approved by:	bapt (mentor)
  Obtained from:	OpenBSD
  Differential Revision:	https://reviews.freebsd.org/D4547

Modified:
  head/usr.sbin/ypldap/ldapclient.c
  head/usr.sbin/ypldap/ypldap.c
  head/usr.sbin/ypldap/ypldap_dns.c

Modified: head/usr.sbin/ypldap/ldapclient.c
==============================================================================
--- head/usr.sbin/ypldap/ldapclient.c	Tue Dec 15 15:22:33 2015	(r292269)
+++ head/usr.sbin/ypldap/ldapclient.c	Tue Dec 15 15:37:58 2015	(r292270)
@@ -172,7 +172,7 @@ client_dispatch_dns(int fd, short events
 		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 eve
 		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");

Modified: head/usr.sbin/ypldap/ypldap.c
==============================================================================
--- head/usr.sbin/ypldap/ypldap.c	Tue Dec 15 15:22:33 2015	(r292269)
+++ head/usr.sbin/ypldap/ypldap.c	Tue Dec 15 15:37:58 2015	(r292270)
@@ -361,7 +361,7 @@ main_dispatch_client(int fd, short event
 		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;

Modified: head/usr.sbin/ypldap/ypldap_dns.c
==============================================================================
--- head/usr.sbin/ypldap/ypldap_dns.c	Tue Dec 15 15:22:33 2015	(r292269)
+++ head/usr.sbin/ypldap/ypldap_dns.c	Tue Dec 15 15:37:58 2015	(r292270)
@@ -140,7 +140,7 @@ dns_dispatch_imsg(int fd, short events, 
 		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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512151537.tBFFbw36080768>