summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-01-05 22:48:50 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2016-01-07 17:27:08 +0100
commit3730d8a225fe33a0157e0aaa85121ef7cecf288d (patch)
tree775953958607557cd63cf30a032a2e06d1750c17 /client
parent1236333333c351b93593b12c0e20b06313e4ac29 (diff)
downloadmariadb-git-3730d8a225fe33a0157e0aaa85121ef7cecf288d.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.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index c601fb57f2f..026934a2feb 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -5121,12 +5121,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);