diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2016-01-05 22:48:50 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2016-06-08 17:13:49 +0000 |
commit | 7adf04e237c41d323b5181c108e7babed3c015fa (patch) | |
tree | f07e1781882e5d30c216c5817227bef84f9367da /client | |
parent | a4848e975d2fe359ff354e767427c01dbe908037 (diff) | |
download | mariadb-git-7adf04e237c41d323b5181c108e7babed3c015fa.tar.gz |
MDEV-9366 : do_shutdown_server fails to detect server shutdown on Windows.
Fix test whether process is alive in mysqltest.
Also fix SHUT_RD definition on Windows to be SD_RECEIVE.
SD_BOTH was used instead prior to this patch, and this would
occasionally make mysql_shutdown() fail - when the socket for the current connection
is not able send the COM_SHUTDOWN response anymore.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 9a1dfaa18ef..3652d1a40e2 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5086,12 +5086,13 @@ static int my_kill(int pid, int sig) { #ifdef __WIN__ HANDLE proc; - if ((proc= OpenProcess(PROCESS_TERMINATE, FALSE, pid)) == NULL) + if ((proc= OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, pid)) == NULL) return -1; if (sig == 0) { + DWORD wait_result= WaitForSingleObject(proc, 0); CloseHandle(proc); - return 0; + return wait_result == WAIT_OBJECT_0?-1:0; } (void)TerminateProcess(proc, 201); CloseHandle(proc); |