summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-02-19 09:13:48 +0100
committerunknown <serg@serg.mylan>2004-02-19 09:13:48 +0100
commitefca692ae70d9b47c37a9c9e8c7f85150a11ec23 (patch)
treed70386f6e7561c8b4cc6ac5928edd4b25a96b4c4 /sql
parent9c69768e3fecc41f8f0f973fe59ee9cd7e4f7d04 (diff)
parentddf17601f3db71fc7bd8531fcbe3b3222e58e87e (diff)
downloadmariadb-git-efca692ae70d9b47c37a9c9e8c7f85150a11ec23.tar.gz
Merge bk-internal:/home/bk/mysql-4.0/
into serg.mylan:/usr/home/serg/Abk/mysql-4.0
Diffstat (limited to 'sql')
-rw-r--r--sql/log.cc15
-rw-r--r--sql/mini_client.cc5
-rw-r--r--sql/mysqld.cc5
3 files changed, 15 insertions, 10 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 8bd42d28e59..c73673d3552 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -202,7 +202,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
open_flags |= O_RDWR;
else
open_flags |= O_WRONLY;
-
+
db[0]=0;
open_count++;
if ((file=my_open(log_file_name,open_flags,
@@ -215,12 +215,15 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
case LOG_NORMAL:
{
char *end;
+ int len=my_snprintf(buff, sizeof(buff),
#ifdef __NT__
- sprintf(buff, "%s, Version: %s, started with:\nTCP Port: %d, Named Pipe: %s\n", my_progname, server_version, mysql_port, mysql_unix_port);
+ "%s, Version: %s, started with:\nTCP Port: %d, Named Pipe: %s\n",
#else
- sprintf(buff, "%s, Version: %s, started with:\nTcp port: %d Unix socket: %s\n", my_progname,server_version,mysql_port,mysql_unix_port);
+ "%s, Version: %s, started with:\nTcp port: %d Unix socket: %s\n",
#endif
- end=strmov(strend(buff),"Time Id Command Argument\n");
+ my_progname, server_version, mysql_port, mysql_unix_port);
+ end=strnmov(buff+len,"Time Id Command Argument\n",
+ sizeof(buff)-len);
if (my_b_write(&log_file, (byte*) buff,(uint) (end-buff)) ||
flush_io_cache(&log_file))
goto err;
@@ -231,7 +234,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
time_t skr=time(NULL);
struct tm tm_tmp;
localtime_r(&skr,&tm_tmp);
- sprintf(buff,"# %s, Version: %s at %02d%02d%02d %2d:%02d:%02d\n",
+ my_snprintf(buff,sizeof(buff),"# %s, Version: %s at %02d%02d%02d %2d:%02d:%02d\n",
my_progname,server_version,
tm_tmp.tm_year % 100,
tm_tmp.tm_mon+1,
@@ -254,7 +257,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
index_file_name_arg= name; // Use same basename for index file
opt= MY_UNPACK_FILENAME | MY_REPLACE_EXT;
}
-
+
if (!my_b_filelength(&log_file))
{
/*
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index 7db9f046389..abe51564c98 100644
--- a/sql/mini_client.cc
+++ b/sql/mini_client.cc
@@ -117,7 +117,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 szPipeName [512];
DWORD dwMode;
int i;
my_bool testing_named_pipes=0;
@@ -126,7 +126,8 @@ 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);
+ strxnmov(szPipeName, sizeof(szPipeName), "\\\\", host, "\\pipe\\",
+ unix_socket, NullS);
DBUG_PRINT("info",("Server name: '%s'. Named Pipe: %s",
host, unix_socket));
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e198d477b68..250bcb37d41 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -189,7 +189,7 @@ static const char* default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace",
#endif
#ifdef __NT__
-static char szPipeName [ 257 ];
+static char szPipeName [512];
static SECURITY_ATTRIBUTES saPipeSecurity;
static SECURITY_DESCRIPTOR sdPipeDescriptor;
static HANDLE hPipe = INVALID_HANDLE_VALUE;
@@ -1173,7 +1173,8 @@ static void server_init(void)
if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap &&
opt_enable_named_pipe)
{
- sprintf( szPipeName, "\\\\.\\pipe\\%s", mysql_unix_port );
+ strxnmov(szPipeName, sizeof(szPipeName), "\\\\.\\pipe\\",
+ unix_socket, NullS);
ZeroMemory( &saPipeSecurity, sizeof(saPipeSecurity) );
ZeroMemory( &sdPipeDescriptor, sizeof(sdPipeDescriptor) );
if ( !InitializeSecurityDescriptor(&sdPipeDescriptor,