[Midnightbsd-cvs] src [7488] trunk/lib/libc/net/nscachedcli.c: avoid SIGPIPE when nscd closes the connection.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Mar 20 17:55:46 EDT 2016


Revision: 7488
          http://svnweb.midnightbsd.org/src/?rev=7488
Author:   laffer1
Date:     2016-03-20 17:55:46 -0400 (Sun, 20 Mar 2016)
Log Message:
-----------
avoid SIGPIPE when nscd closes the connection.

Modified Paths:
--------------
    trunk/lib/libc/net/nscachedcli.c

Modified: trunk/lib/libc/net/nscachedcli.c
===================================================================
--- trunk/lib/libc/net/nscachedcli.c	2016-03-20 21:53:51 UTC (rev 7487)
+++ trunk/lib/libc/net/nscachedcli.c	2016-03-20 21:55:46 UTC (rev 7488)
@@ -75,9 +75,10 @@
 		nevents = _kevent(connection->write_queue, NULL, 0, &eventlist,
 		    1, &timeout);
 		if ((nevents == 1) && (eventlist.filter == EVFILT_WRITE)) {
-			s_result = _write(connection->sockfd, data + result,
+			s_result = _sendto(connection->sockfd, data + result,
 			    eventlist.data < data_size - result ?
-			    eventlist.data : data_size - result);
+			    eventlist.data : data_size - result, MSG_NOSIGNAL,
+			    NULL, 0);
 			if (s_result == -1)
 				return (-1);
 			else
@@ -175,8 +176,8 @@
 	nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, 1,
 	    NULL);
 	if (nevents == 1 && eventlist.filter == EVFILT_WRITE) {
-		result = (_sendmsg(connection->sockfd, &cred_hdr, 0) == -1) ?
-		    -1 : 0;
+		result = (_sendmsg(connection->sockfd, &cred_hdr,
+		    MSG_NOSIGNAL) == -1) ?  -1 : 0;
 		EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD,
 		    0, 0, NULL);
 		_kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL);



More information about the Midnightbsd-cvs mailing list