summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-06-10 11:05:07 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-06-10 11:05:07 -0300
commita141a6375aebc01c6a4c3d4430860a8a2e772f79 (patch)
tree380d04ae2b05a1fdc0bb16f16ae1651f875cc2dd /sql-common
parentf4cb42bca9eb8f810747fa552a8ac88557a01b2a (diff)
parent425790610d3e94b0b76f85aecf7aa197f06fd93b (diff)
downloadmariadb-git-a141a6375aebc01c6a4c3d4430860a8a2e772f79.tar.gz
Merge from mysql-5.0-bugteam.
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index a6a2be1086f..2cbc15ad746 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -477,6 +477,9 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
DWORD error_code = 0;
DWORD event_access_rights= SYNCHRONIZE | EVENT_MODIFY_STATE;
char *shared_memory_base_name = mysql->options.shared_memory_base_name;
+ static const char *name_prefixes[] = {"","Global\\"};
+ const char *prefix;
+ int i;
/*
get enough space base-name + '_' + longest suffix we might ever send
@@ -491,9 +494,18 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
shared_memory_base_name is unique value for each server
unique_part is uniquel value for each object (events and file-mapping)
*/
- suffix_pos = strxmov(tmp, "Global\\", shared_memory_base_name, "_", NullS);
- strmov(suffix_pos, "CONNECT_REQUEST");
- if (!(event_connect_request= OpenEvent(event_access_rights, FALSE, tmp)))
+ for (i = 0; i< array_elements(name_prefixes); i++)
+ {
+ prefix= name_prefixes[i];
+ suffix_pos = strxmov(tmp, prefix , shared_memory_base_name, "_", NullS);
+ strmov(suffix_pos, "CONNECT_REQUEST");
+ event_connect_request= OpenEvent(event_access_rights, FALSE, tmp);
+ if (event_connect_request)
+ {
+ break;
+ }
+ }
+ if (!event_connect_request)
{
error_allow = CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR;
goto err;
@@ -545,7 +557,7 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
unique_part is uniquel value for each object (events and file-mapping)
number_of_connection is number of connection between server and client
*/
- suffix_pos = strxmov(tmp, "Global\\", shared_memory_base_name, "_", connect_number_char,
+ suffix_pos = strxmov(tmp, prefix , shared_memory_base_name, "_", connect_number_char,
"_", NullS);
strmov(suffix_pos, "DATA");
if ((handle_file_map = OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)) == NULL)