diff src/channel.c @ 8354:b151c3f9be72 v7.4.1469

commit https://github.com/vim/vim/commit/42bc6dde46f1b52476cc84ee89277f981b4116c4 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 2 20:48:47 2016 +0100 patch 7.4.1469 Problem: Channel test sometimes fails, especially on OS/X. (Kazunobu Kuriyama) Solution: Change the && into ||, call getsockopt() in more situations. (Ozaki Kiichi)
author Christian Brabandt <cb@256bit.org>
date Wed, 02 Mar 2016 21:00:04 +0100
parents a0cff08e7aa3
children e0d576743e4f
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -720,10 +720,10 @@ channel_open(
 	     * After putting the socket in non-blocking mode, connect() will
 	     * return EINPROGRESS, select() will not wait (as if writing is
 	     * possible), need to use getsockopt() to check if the socket is
-	     * actually connect.
-	     * We detect an failure to connect when both read and write fds
+	     * actually able to connect.
+	     * We detect an failure to connect when either read and write fds
 	     * are set.  Use getsockopt() to find out what kind of failure. */
-	    if (FD_ISSET(sd, &rfds) && FD_ISSET(sd, &wfds))
+	    if (FD_ISSET(sd, &rfds) || FD_ISSET(sd, &wfds))
 	    {
 		ret = getsockopt(sd,
 			    SOL_SOCKET, SO_ERROR, &so_error, &so_error_len);
@@ -1559,7 +1559,8 @@ may_invoke_callback(channel_T *channel, 
 
 	    curbuf = buffer;
 	    u_sync(TRUE);
-	    u_save(lnum, lnum + 1);
+	    /* ignore undo failure, undo is not very useful here */
+	    ignored = u_save(lnum, lnum + 1);
 
 	    if (msg == NULL)
 		/* JSON or JS mode: re-encode the message. */