From 18d974a3e7b48eec96c8837d42ebbc698e68ca55 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Jul 2004 07:38:46 +0300 Subject: [PATCH] Don't close already closed files in vio (not critical) mysys/my_init.c: Extra debugging sql/mysqld.cc: Added comment sql/sql_parse.cc: Removed unneeded info vio/viosocket.c: Added assert. Don't close already closed files --- mysys/my_init.c | 1 + sql/mysqld.cc | 13 +++++++++++++ sql/sql_parse.cc | 1 - vio/viosocket.c | 4 +++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mysys/my_init.c b/mysys/my_init.c index da0e6caf96d..0ef938b434c 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -127,6 +127,7 @@ void my_end(int infoflag) FILE *info_file; if (!(info_file=DBUG_FILE)) info_file=stderr; + DBUG_PRINT("info",("Shutting down")); if (infoflag & MY_CHECK_ERROR || info_file != stderr) { /* Test if some file is left open */ if (my_file_opened | my_stream_opened) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1ed535753b1..4fd13d33bab 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1301,6 +1301,19 @@ void yyerror(const char *s) #ifndef EMBEDDED_LIBRARY +/* + Close a connection + + SYNOPSIS + close_connection() + thd Thread handle + errcode Error code to print to console + lock 1 if we have have to lock LOCK_thread_count + + NOTES + For the connection that is doing shutdown, this is called twice +*/ + void close_connection(THD *thd, uint errcode, bool lock) { st_vio *vio; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 61b57b2f350..e83868bac7c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4562,7 +4562,6 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, register TABLE_LIST *ptr; char *alias_str; DBUG_ENTER("add_table_to_list"); - DBUG_PRINT("enter",("lock_option: %d", lock_type)); if (!table) DBUG_RETURN(0); // End of memory diff --git a/vio/viosocket.c b/vio/viosocket.c index 8dea06d4adf..48a9058480a 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -203,9 +203,11 @@ int vio_close(Vio * vio) #endif r=CloseHandle(vio->hPipe); } - else if (vio->type != VIO_CLOSED) + else #endif /* __WIN__ */ + if (vio->type != VIO_CLOSED) { + DBUG_ASSERT(vio->sd >= 0); if (shutdown(vio->sd,2)) r= -1; if (closesocket(vio->sd))