summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2004-02-22 11:01:28 +0200
committerunknown <monty@mashka.mysql.fi>2004-02-22 11:01:28 +0200
commit07b40e621e5ff2a285b673b6b7bab345c7c361cf (patch)
tree5cbf5acd9871f4013aae8ed412d72912dbc4706f /sql-common
parent4e17890f6afaddfa8bcdb483a60505b7aee1f652 (diff)
parenta594279dc99b0397476fbc4b2179657cd1a3e9e7 (diff)
downloadmariadb-git-07b40e621e5ff2a285b673b6b7bab345c7c361cf.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mashka.mysql.fi:/home/my/mysql-4.1 innobase/rem/rem0cmp.c: Auto merged libmysql/libmysql.c: Auto merged sql-common/client.c: Auto merged sql/ha_innodb.cc: Auto merged sql/sql_base.cc: Auto merged
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index a4ec7db6515..a22ac22f08a 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -286,7 +286,7 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
char **arg_unix_socket)
{
HANDLE hPipe=INVALID_HANDLE_VALUE;
- char szPipeName [ 257 ];
+ char pipe_name[1024];
DWORD dwMode;
int i;
my_bool testing_named_pipes=0;
@@ -297,13 +297,15 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
if (!host || !strcmp(host,LOCAL_HOST))
host=LOCAL_HOST_NAMEDPIPE;
- sprintf( szPipeName, "\\\\%s\\pipe\\%s", host, unix_socket);
- DBUG_PRINT("info",("Server name: '%s'. Named Pipe: %s",
- host, unix_socket));
+
+ pipe_name[sizeof(pipe_name)-1]= 0; /* Safety if too long string */
+ strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\", host, "\\pipe\\",
+ unix_socket, NullS);
+ DBUG_PRINT("info",("Server name: '%s'. Named Pipe: %s", host, unix_socket));
for (i=0 ; i < 100 ; i++) /* Don't retry forever */
{
- if ((hPipe = CreateFile(szPipeName,
+ if ((hPipe = CreateFile(pipe_name,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
@@ -320,7 +322,7 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
return INVALID_HANDLE_VALUE;
}
/* wait for for an other instance */
- if (! WaitNamedPipe(szPipeName, connect_timeout*1000) )
+ if (! WaitNamedPipe(pipe_name, connect_timeout*1000) )
{
net->last_errno=CR_NAMEDPIPEWAIT_ERROR;
strmov(net->sqlstate, unknown_sqlstate);