diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2016-08-02 18:52:51 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2016-08-02 18:52:51 +0200 |
commit | 6b71a6d2d935d997f43a658d45d1e518620cf0ad (patch) | |
tree | d1bbd09a0ffca3e0c14231d993a7bc06aacb9565 /sql | |
parent | 5fdb3cfcd432b85dc305a1a61c2d018a798a6ac3 (diff) | |
download | mariadb-git-6b71a6d2d935d997f43a658d45d1e518620cf0ad.tar.gz |
MDEV-10383 Named pipes : multiple servers can listen on the same pipename
Use FILE_FLAG_FIRST_PIPE_INSTANCE with the first CreateNamedPipe()
call to make sure the pipe does not already exist.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3450447ceb9..9b8f964629d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2316,26 +2316,17 @@ static void network_init(void) saPipeSecurity.lpSecurityDescriptor = &sdPipeDescriptor; saPipeSecurity.bInheritHandle = FALSE; if ((hPipe= CreateNamedPipe(pipe_name, - PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED, - PIPE_TYPE_BYTE | - PIPE_READMODE_BYTE | - PIPE_WAIT, - PIPE_UNLIMITED_INSTANCES, - (int) global_system_variables.net_buffer_length, - (int) global_system_variables.net_buffer_length, - NMPWAIT_USE_DEFAULT_WAIT, - &saPipeSecurity)) == INVALID_HANDLE_VALUE) - { - LPVOID lpMsgBuf; - int error=GetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, 0, NULL ); - sql_perror((char *)lpMsgBuf); - LocalFree(lpMsgBuf); - unireg_abort(1); - } + PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE, + PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, + (int) global_system_variables.net_buffer_length, + (int) global_system_variables.net_buffer_length, + NMPWAIT_USE_DEFAULT_WAIT, + &saPipeSecurity)) == INVALID_HANDLE_VALUE) + { + sql_perror("Create named pipe failed"); + unireg_abort(1); + } } #endif |