Patch 8.2.3041

5 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 23, 2021, 3:13:51 PM6/23/21
to vim...@googlegroups.com

Patch 8.2.3041
Problem: Detecting if the process of a swap file is running fails if the
process is owned by another user.
Solution: Check for the ESRCH error. (closes #8436)
Files: src/os_unix.c


*** ../vim-8.2.3040/src/os_unix.c 2021-06-01 20:48:35.283404265 +0200
--- src/os_unix.c 2021-06-23 21:09:49.690146779 +0200
***************
*** 2486,2493 ****
int
mch_process_running(long pid)
{
! // EMX kill() not working correctly, it seems
! return kill(pid, 0) == 0;
}

#if !defined(HAVE_STRERROR) && defined(USE_GETCWD)
--- 2486,2502 ----
int
mch_process_running(long pid)
{
! // If there is no error the process must be running.
! if (kill(pid, 0) == 0)
! return TRUE;
! #ifdef ESRCH
! // If the error is ESRCH then the process is not running.
! if (errno == ESRCH)
! return FALSE;
! #endif
! // If the process is running and owned by another user we get EPERM. With
! // other errors the process might be running, assuming it is then.
! return TRUE;
}

#if !defined(HAVE_STRERROR) && defined(USE_GETCWD)
*** ../vim-8.2.3040/src/version.c 2021-06-23 20:46:46.914256853 +0200
--- src/version.c 2021-06-23 21:12:42.133663310 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3041,
/**/

--
I am also told that there is a logical proof out there somewhere
that demonstrates that there is no task which duct tape cannot handle.
-- Paul Brannan

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages