Re: [PATCH v2] gc: reject if another gc is running, unless --force is given

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 03.08.2013 12:01, schrieb Duy Nguyen:
> On Sat, Aug 03, 2013 at 11:49:02AM +0200, Johannes Sixt wrote:
>> Am 03.08.2013 08:21, schrieb Nguyễn Thái Ngọc Duy:
>>>  I changed mingw.h to add a stub uname() because I don't think MinGW
>>>  port has that function, but that's totally untested.
>>
>> Thanks, but we don't have kill(pid, 0), either :-(
> 
> Yeah, I should have checked. Will this work?
> 
> -- 8< --
> diff --git a/compat/mingw.c b/compat/mingw.c
> index bb92c43..14d92df 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -1086,6 +1086,12 @@ int mingw_kill(pid_t pid, int sig)
>  		errno = err_win_to_posix(GetLastError());
>  		CloseHandle(h);
>  		return -1;
> +	} else if (pid > 0 && sig == 0) {
> +		HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
> +		if (h) {
> +			CloseHandle(h);
> +			return 0;
> +		}
>  	}
>  
>  	errno = EINVAL;
> -- 8< --
> 

Looks reasonable. PROCESS_QUERY_INFORMATION instead of PROCESS_TERMINATE
should be sufficient, and errno = ESRCH; return -1; is missing.

-- Hannes

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]