summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@tik.mysql.fi>2002-04-16 16:29:14 +0300
committerunknown <monty@tik.mysql.fi>2002-04-16 16:29:14 +0300
commit667da1396b5a20ad7b4ba94136e47e64b6368daa (patch)
tree1ffc14ca2c35e314c452fe5d5169332a4e892d85 /sql
parent0eb8770799374dc2a9ab4962b77de8bbc4015f93 (diff)
downloadmariadb-git-667da1396b5a20ad7b4ba94136e47e64b6368daa.tar.gz
Fixed pthread_cond_timedwait() for HPUX and DCE threads
Cleanup of LIBWRAP handling Docs/manual.texi: Changelog include/my_pthread.h: Fixed pthread_cond_timedwait() for HPUX and DCE threads mysys/my_pthread.c: Fixed pthread_cond_timedwait() for HPUX and DCE threads sql/item_func.cc: Fixed the GET_LOCK() works with HPUX and DCE threads sql/mysqld.cc: Cleanup of LIBWRAP handling sql/sql_parse.cc: Safety fix
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/mysqld.cc51
-rw-r--r--sql/sql_parse.cc2
3 files changed, 31 insertions, 24 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 023b79b3ff7..2e54aa56b4b 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1514,7 +1514,7 @@ longlong Item_func_get_lock::val_int()
while (!thd->killed &&
(error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime))
- != ETIME && error != ETIMEDOUT && ull->locked) ;
+ != ETIME && error != ETIMEDOUT && error != EINVAL && ull->locked) ;
if (thd->killed)
error=EINTR; // Return NULL
if (ull->locked)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index fa5f6ae395e..16eace54978 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -89,6 +89,16 @@ extern "C" { // Because of SCO 3.2V4.2
#endif /* NEED_SYS_SYSLOG_H */
int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;
+
+#ifdef __linux__
+#define my_fromhost(A) fromhost()
+#define my_hosts_access(A) hosts_access()
+#define my_eval_client(A) eval_client()
+#else
+#define my_fromhost(A) fromhost(A)
+#define my_hosts_access(A) hosts_access(A)
+#define my_eval_client(A) eval_client(A)
+#endif
#endif /* HAVE_LIBWRAP */
#ifdef HAVE_SYS_MMAN_H
@@ -2258,7 +2268,6 @@ static void create_new_thread(THD *thd)
if (cached_thread_count > wake_thread)
{
start_cached_thread(thd);
- (void) pthread_mutex_unlock(&LOCK_thread_count);
}
else
{
@@ -2285,9 +2294,9 @@ static void create_new_thread(THD *thd)
(void) pthread_mutex_unlock(&LOCK_thread_count);
DBUG_VOID_RETURN;
}
-
- (void) pthread_mutex_unlock(&LOCK_thread_count);
}
+ (void) pthread_mutex_unlock(&LOCK_thread_count);
+
}
DBUG_PRINT("info",("Thread created"));
DBUG_VOID_RETURN;
@@ -2415,29 +2424,27 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
struct request_info req;
signal(SIGCHLD, SIG_DFL);
request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL);
-#ifndef __linux__
- fromhost(&req);
- if (!hosts_access(&req))
- {
- // This may be stupid but refuse() includes an exit(0)
- // which we surely don't want...
- // clean_exit() - same stupid thing ...
- syslog(deny_severity, "refused connect from %s", eval_client(&req));
-#else
- fromhost();
- if (!hosts_access())
+ my_fromhost(&req);
+ if (!my_hosts_access(&req))
{
- syslog(deny_severity, "refused connect from %s", eval_client());
-#endif
+ /*
+ This may be stupid but refuse() includes an exit(0)
+ which we surely don't want...
+ clean_exit() - same stupid thing ...
+ */
+ syslog(deny_severity, "refused connect from %s",
+ my_eval_client(&req));
+
+ /*
+ C++ sucks (the gibberish in front just translates the supplied
+ sink function pointer in the req structure from a void (*sink)();
+ to a void(*sink)(int) if you omit the cast, the C++ compiler
+ will cry...
+ */
if (req.sink)
((void (*)(int))req.sink)(req.fd);
- // C++ sucks (the gibberish in front just translates the supplied
- // sink function pointer in the req structure from a void (*sink)();
- // to a void(*sink)(int) if you omit the cast, the C++ compiler
- // will cry...
-
- (void) shutdown(new_sock,2); // This looks fine to me...
+ (void) shutdown(new_sock,2);
(void) closesocket(new_sock);
continue;
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index fa4a4fd4f3b..4f9140cc3f2 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -530,7 +530,7 @@ pthread_handler_decl(handle_one_connection,arg)
if ((error=check_connections(thd)))
{ // Wrong permissions
if (error > 0)
- net_printf(net,error,thd->host ? thd->host : thd->ip);
+ net_printf(net,error,thd->host ? thd->host : (thd->ip ? thd->ip : ""));
#ifdef __NT__
if (vio_type(net->vio) == VIO_TYPE_NAMEDPIPE)
sleep(1); /* must wait after eof() */