From 2a4845b48461a472522b57a9c9e1c11ae76f712f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 11 Oct 2001 22:02:16 +0300 Subject: [PATCH] Cleanups client/mysqlmanagerc.c: Only use needed include files libmysql/manager.c: cleanup include files scripts/make_binary_distribution.sh: Fixed wrong filename sql/mysqld.cc: cleanup tools/mysqlmanager.c: Read with retrys --- client/mysqlmanagerc.c | 16 ++---------- libmysql/manager.c | 38 ++++++++++++----------------- scripts/make_binary_distribution.sh | 2 +- sql/mysqld.cc | 4 +-- tools/mysqlmanager.c | 11 +++++++-- 5 files changed, 29 insertions(+), 42 deletions(-) diff --git a/client/mysqlmanagerc.c b/client/mysqlmanagerc.c index 66b77e237e2..4e34c85d55d 100644 --- a/client/mysqlmanagerc.c +++ b/client/mysqlmanagerc.c @@ -17,27 +17,15 @@ #define MANAGER_CLIENT_VERSION "1.0" #include -#include -#include #include #include -#include -#ifdef OS2 -#include -#else -#include -#endif -#include -#include #include -#include -#include +#include +#include #include #include #include #include -#include -#include #ifndef MYSQL_MANAGER_PORT #define MYSQL_MANAGER_PORT 23546 diff --git a/libmysql/manager.c b/libmysql/manager.c index 07595ab8dee..2f34f49209c 100644 --- a/libmysql/manager.c +++ b/libmysql/manager.c @@ -16,31 +16,30 @@ MA 02111-1307, USA */ #include -#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64) -#include -#include +#if defined(THREAD) +#include /* because of signal() */ #endif +#include "mysql.h" +#include "mysql_version.h" +#include "mysqld_error.h" #include #include #include #include -#include "mysql.h" -#include "mysql_version.h" -#include "mysqld_error.h" -#include "errmsg.h" +#include +#include #include #include #include -#include #include -#ifdef HAVE_PWD_H -#include +#if defined(OS2) +# include +#elif !defined( __WIN__) +#include +#ifdef HAVE_SYS_UN_H +# include #endif -#if !defined(MSDOS) && !defined(__WIN__) -#include -#include -#include #include #ifdef HAVE_SELECT_H # include @@ -48,18 +47,13 @@ #ifdef HAVE_SYS_SELECT_H #include #endif -#endif -#ifdef HAVE_SYS_UN_H -# include -#endif -#if defined(THREAD) && !defined(__WIN__) -#include /* because of signal() */ -#endif +#include +#endif /* __WIN__ */ + #ifndef INADDR_NONE #define INADDR_NONE -1 #endif - #define RES_BUF_SHIFT 5 #define SOCKET_ERROR -1 #define NET_BUF_SIZE 2048 diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 24dee288706..b743e228a0f 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -70,7 +70,7 @@ for i in extra/comp_err extra/replace extra/perror extra/resolveip \ client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \ client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest \ client/.libs/mysqlcheck \ - client/.libs/mysqlmanagerc client/libs/mysqlmanager-pwgen \ + client/.libs/mysqlmanagerc client/.libs/mysqlmanager-pwgen \ tools/.libs/mysqlmanager do if [ -f $i ] diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ca9c0bae682..65b130bfd82 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -77,9 +77,7 @@ extern "C" { // Because of SCO 3.2V4.2 #include #endif #include -#else -#include -#endif // __WIN__ +#endif /* __WIN__ */ #ifdef HAVE_LIBWRAP #include diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index f2f89c6bc07..9cb04505e2f 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -88,6 +88,8 @@ #define MAX_LAUNCHER_MSG 256 #endif +#define MAX_RETRY_COUNT 100 + /* Variable naming convention - if starts with manager_, either is set directly by the user, or used closely in ocnjunction with a variable set by the user @@ -1161,10 +1163,15 @@ static char* read_line(struct manager_thd* thd) { int len,read_len; char *block_end,*p_back; + uint retry_count=0; + read_len = min(NET_BLOCK,(uint)(buf_end-p)); - if ((len=vio_read(thd->vio,p,read_len))<=0) + while ((len=vio_read(thd->vio,p,read_len))<=0) { - log_err("Error reading command from client"); + if (vio_should_retry(thd->vio) && retry_count++ < MAX_RETRY_COUNT) + continue; + log_err("Error reading command from client (Error: %d)", + vio_errno(thd->vio)); thd->fatal=1; return 0; }