From 984750e13ef4a559c5da05b5fbd6fa363d3650b2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 22 Feb 2004 08:09:32 +0200 Subject: After merge fixes Fixed wrong test of database name (affected optimization of ORDER BY) VC++Files/client/mysqlclient.dsp: Add my_file.c VC++Files/mysys/mysys.dsp: Add my_file.c mysql-test/r/negation_elimination.result: Fix wrong test sql-common/client.c: After merge fix sql/sql_base.cc: Fixed testing of database name --- sql-common/client.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sql-common/client.c') diff --git a/sql-common/client.c b/sql-common/client.c index 36b2c6122dd..fc5004c4a82 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); -- cgit v1.2.1