mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3041: detecting if the process of a swap file is running fails
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)
This commit is contained in:
parent
18d46587b9
commit
44dea9da4b
@ -2486,8 +2486,17 @@ mch_get_pid(void)
|
||||
int
|
||||
mch_process_running(long pid)
|
||||
{
|
||||
// EMX kill() not working correctly, it seems
|
||||
return kill(pid, 0) == 0;
|
||||
// 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)
|
||||
|
@ -755,6 +755,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
3041,
|
||||
/**/
|
||||
3040,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user