With athena gui version on AIX, vim will consistently go into an
infinite loop if the network connection drops.  Trussing such a process
points to a select system call, so I found this one without any check on
the return value.  This patch mostly prevents the problem, although
not quite 100% of the time.

My EINTR check is just what I'm guessing some other OSes might need, it
doesn't seem to matter for AIX.  In fact the error-handling I'm doing
below doesn't seem to matter either, as I can't get it to execute, nor
cai I stop there in a debugger, but the check seems enough for exiting
the process via somewhere in X libraries.

Though this code isn't gui-specific, I haven't seen this behaviour in a
terminal, however I mostly use screen for network sessions.


diff --git a/src/os_unix.c b/src/os_unix.c
index a3c09f75e..c04fd3061 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -587,6 +587,8 @@ mch_delay(long msec, int ignoreinput)
 
     if (ignoreinput)
     {
+       int poll_result = 0;
+
        /* Go to cooked mode without echo, to allow SIGINT interrupting us
         * here.  But we don't want QUIT to kill us (CTRL-\ used in a
         * shell may produce SIGQUIT). */
@@ -628,7 +630,7 @@ mch_delay(long msec, int ignoreinput)
        usleep((unsigned int)(msec * 1000));
 # else
 #  ifndef HAVE_SELECT
-       poll(NULL, 0, (int)msec);
+       poll_result = poll(NULL, 0, (int)msec);
 #  else
        {
            struct timeval tv;
@@ -639,7 +641,14 @@ mch_delay(long msec, int ignoreinput)
             * NOTE: Solaris 2.6 has a bug that makes select() hang here.  Get
             * a patch from Sun to fix this.  Reported by Gunnar Pedersen.
             */
-           select(0, NULL, NULL, NULL, &tv);
+           poll_result = select(0, NULL, NULL, NULL, &tv);
+       }
+       if (poll_result < 0 && errno != EINTR)
+       {
+           OUT_STR(strerror(errno));
+           OUT_STR("Vim: poll or select failed, exiting\n");
+           out_flush();
+           getout(errno);
        }
 #  endif /* HAVE_SELECT */
 # endif /* HAVE_NANOSLEEP */

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20191027191839.GA24639%40ma.sdf.org.

Raspunde prin e-mail lui