To: vim-dev@vim.org Subject: Patch 5.6a.026 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6a.026 Problem: When the SNiFF connection is open, shell commands hang. (Pruemmer) Solution: Skip a second wait() call if waitpid() already detected that the child has exited. Files: src/os_unix.c *** ../vim-5.6a.25/src/os_unix.c Mon Dec 20 09:59:13 1999 --- src/os_unix.c Fri Jan 14 22:27:22 2000 *************** *** 2171,2177 **** char_u *newcmd = NULL; pid_t pid; ! pid_t wait_pid; #ifdef HAVE_UNION_WAIT union wait status; #else --- 2171,2177 ---- char_u *newcmd = NULL; pid_t pid; ! pid_t wait_pid = 0; #ifdef HAVE_UNION_WAIT union wait status; #else *************** *** 2631,2637 **** --- 2631,2641 ---- #endif if ((wait_pid == (pid_t)-1 && errno == ECHILD) || (wait_pid == pid && WIFEXITED(status))) + { + wait_pid = pid; break; + } + wait_pid = 0; } finished: p_more = p_more_save; *************** *** 2653,2664 **** * Wait until our child has exited. * Ignore wait() returning pids of other children and returning * because of some signal like SIGWINCH. */ ! for (;;) { wait_pid = wait(&status); - if (wait_pid == pid) - break; if (wait_pid <= 0 #ifdef ECHILD && errno == ECHILD --- 2657,2668 ---- * Wait until our child has exited. * Ignore wait() returning pids of other children and returning * because of some signal like SIGWINCH. + * Don't wait if wait_pid was already set above, indicating the + * child already exited. */ ! while (wait_pid != pid) { wait_pid = wait(&status); if (wait_pid <= 0 #ifdef ECHILD && errno == ECHILD *** ../vim-5.6a.25/src/version.c Thu Jan 13 23:05:21 2000 --- src/version.c Fri Jan 14 22:24:09 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 26, /**/ -- hundred-and-one symptoms of being an internet addict: 173. You keep tracking down the email addresses of all your friends (even childhood friends). --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /