diff options
author | unknown <serg@serg.mylan> | 2004-02-19 09:11:46 +0100 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2004-02-19 09:11:46 +0100 |
commit | ddf17601f3db71fc7bd8531fcbe3b3222e58e87e (patch) | |
tree | be8ef133c8fd7008e97a8ce6fc64816e34258ec5 /sql/log.cc | |
parent | 65ec6a41b65f26552481be24ac8947c83eeea198 (diff) | |
download | mariadb-git-ddf17601f3db71fc7bd8531fcbe3b3222e58e87e.tar.gz |
potential problem fixed afer some reasoning
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 15 |
1 files changed, 9 insertions, 6 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)) { /* |