summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2004-02-21 20:11:47 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2004-02-21 20:11:47 +0200
commit62b22fb71a9b9c56c4824fbf6f1ea53a3a366935 (patch)
tree5631f15bd227d0a0081c4d15cc392fb29b1ed8fa /sql
parent3dcd3d4be9d41d0dd7f9e443d2ab8631cfeaebe4 (diff)
parentecf6eeca6069ea85cc99fa6d381fb6d4a53977d2 (diff)
downloadmariadb-git-62b22fb71a9b9c56c4824fbf6f1ea53a3a366935.tar.gz
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/work/mysql-4.0
Diffstat (limited to 'sql')
-rw-r--r--sql/log.cc21
-rw-r--r--sql/mini_client.cc11
-rw-r--r--sql/mysqld.cc44
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/sql_load.cc6
-rw-r--r--sql/unireg.cc4
6 files changed, 50 insertions, 38 deletions
diff --git a/sql/log.cc b/sql/log.cc
index c73673d3552..559d30f28ba 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -231,18 +231,21 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
}
case LOG_NEW:
{
+ uint len;
time_t skr=time(NULL);
struct tm tm_tmp;
+
localtime_r(&skr,&tm_tmp);
- 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,
- tm_tmp.tm_mday,
- tm_tmp.tm_hour,
- tm_tmp.tm_min,
- tm_tmp.tm_sec);
- if (my_b_write(&log_file, (byte*) buff,(uint) strlen(buff)) ||
+ len= 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,
+ tm_tmp.tm_mday,
+ tm_tmp.tm_hour,
+ tm_tmp.tm_min,
+ tm_tmp.tm_sec);
+ if (my_b_write(&log_file, (byte*) buff, len) ||
flush_io_cache(&log_file))
goto err;
break;
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index abe51564c98..86d50dc9a0e 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 [512];
+ char pipe_name[512];
DWORD dwMode;
int i;
my_bool testing_named_pipes=0;
@@ -126,14 +126,15 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
if (!host || !strcmp(host,LOCAL_HOST))
host=LOCAL_HOST_NAMEDPIPE;
- strxnmov(szPipeName, sizeof(szPipeName), "\\\\", host, "\\pipe\\",
- unix_socket, NullS);
+ 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,
@@ -149,7 +150,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;
sprintf(net->last_error,ER(net->last_errno),host, unix_socket,
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 250bcb37d41..4484771d4ed 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 [512];
+static char pipe_name[512];
static SECURITY_ATTRIBUTES saPipeSecurity;
static SECURITY_DESCRIPTOR sdPipeDescriptor;
static HANDLE hPipe = INVALID_HANDLE_VALUE;
@@ -580,7 +580,7 @@ static void close_connections(void)
DBUG_PRINT( "quit", ("Closing named pipes") );
/* Create connection to the handle named pipe handler to break the loop */
- if ((temp = CreateFile(szPipeName,
+ if ((temp = CreateFile(pipe_name,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
@@ -588,7 +588,7 @@ static void close_connections(void)
0,
NULL )) != INVALID_HANDLE_VALUE)
{
- WaitNamedPipe(szPipeName, 1000);
+ WaitNamedPipe(pipe_name, 1000);
DWORD dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
SetNamedPipeHandleState(temp, &dwMode, NULL, NULL);
CancelIo(temp);
@@ -1173,12 +1173,14 @@ static void server_init(void)
if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap &&
opt_enable_named_pipe)
{
- strxnmov(szPipeName, sizeof(szPipeName), "\\\\.\\pipe\\",
- unix_socket, NullS);
- ZeroMemory( &saPipeSecurity, sizeof(saPipeSecurity) );
- ZeroMemory( &sdPipeDescriptor, sizeof(sdPipeDescriptor) );
- if ( !InitializeSecurityDescriptor(&sdPipeDescriptor,
- SECURITY_DESCRIPTOR_REVISION) )
+
+ pipe_name[sizeof(pipe_name)-1]= 0; /* Safety if too long string */
+ strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\.\\pipe\\",
+ unix_socket, NullS);
+ bzero((char*) &saPipeSecurity, sizeof(saPipeSecurity) );
+ bzero((char*) &sdPipeDescriptor, sizeof(sdPipeDescriptor) );
+ if (!InitializeSecurityDescriptor(&sdPipeDescriptor,
+ SECURITY_DESCRIPTOR_REVISION) )
{
sql_perror("Can't start server : Initialize security descriptor");
unireg_abort(1);
@@ -1191,16 +1193,16 @@ static void server_init(void)
saPipeSecurity.nLength = sizeof( SECURITY_ATTRIBUTES );
saPipeSecurity.lpSecurityDescriptor = &sdPipeDescriptor;
saPipeSecurity.bInheritHandle = FALSE;
- if ((hPipe = CreateNamedPipe(szPipeName,
- PIPE_ACCESS_DUPLEX,
- PIPE_TYPE_BYTE |
- PIPE_READMODE_BYTE |
- PIPE_WAIT,
- PIPE_UNLIMITED_INSTANCES,
- (int) global_system_variables.net_buffer_length,
- (int) global_system_variables.net_buffer_length,
- NMPWAIT_USE_DEFAULT_WAIT,
- &saPipeSecurity )) == INVALID_HANDLE_VALUE)
+ if ((hPipe= CreateNamedPipe(pipe_name,
+ PIPE_ACCESS_DUPLEX,
+ PIPE_TYPE_BYTE |
+ PIPE_READMODE_BYTE |
+ PIPE_WAIT,
+ PIPE_UNLIMITED_INSTANCES,
+ (int) global_system_variables.net_buffer_length,
+ (int) global_system_variables.net_buffer_length,
+ NMPWAIT_USE_DEFAULT_WAIT,
+ &saPipeSecurity)) == INVALID_HANDLE_VALUE)
{
LPVOID lpMsgBuf;
int error=GetLastError();
@@ -3075,7 +3077,7 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
if (!fConnected)
{
CloseHandle( hPipe );
- if ((hPipe = CreateNamedPipe(szPipeName,
+ if ((hPipe = CreateNamedPipe(pipe_name,
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE |
PIPE_READMODE_BYTE |
@@ -3093,7 +3095,7 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
}
hConnectedPipe = hPipe;
/* create new pipe for new connection */
- if ((hPipe = CreateNamedPipe(szPipeName,
+ if ((hPipe = CreateNamedPipe(pipe_name,
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE |
PIPE_READMODE_BYTE |
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 18dadf24efa..e5cb4d1e815 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -833,7 +833,7 @@ my_net_read(NET *net)
if (net->remain_in_buf)
{
- buf_length= net->buf_length; // Data left in old packet
+ buf_length= net->buf_length; /* Data left in old packet */
first_packet_offset= start_of_packet= (net->buf_length -
net->remain_in_buf);
/* Restore the character that was overwritten by the end 0 */
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 1603a7eb26a..a3ba14373b2 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -91,7 +91,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
bool is_fifo=0;
LOAD_FILE_INFO lf_info;
char *db = table_list->db; // This is never null
- /* If no current database, use database where table is located */
+ /*
+ If path for file is not defined, we will use the current database.
+ If this is not set, we will use the directory where the table to be
+ loaded is located
+ */
char *tdb= thd->db ? thd->db : db; // Result is never null
bool transactional_table, log_delayed;
ulong skip_lines= ex->skip_lines;
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 955e5cfda8a..218ea6b5b8d 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -150,7 +150,9 @@ int rea_create_table(my_string file_name,
my_free((gptr) screen_buff,MYF(0));
my_afree((gptr) keybuff);
- if (opt_sync_frm && my_sync(file, MYF(MY_WME)))
+
+ if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
+ my_sync(file, MYF(MY_WME)))
goto err2;
if (my_close(file,MYF(MY_WME)) ||
ha_create_table(file_name,create_info,0))