summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 13c3c909e77..0546188f4d5 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2003, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+ Copyright (c) 2009, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -69,9 +69,9 @@ my_bool net_flush(NET *net);
#include "errmsg.h"
#include <violite.h>
-#if !defined(__WIN__)
+#if !defined(_WIN32)
#include <my_pthread.h> /* because of signal() */
-#endif /* !defined(__WIN__) */
+#endif /* !defined(_WIN32) */
#include <sys/stat.h>
#include <signal.h>
@@ -81,29 +81,20 @@ my_bool net_flush(NET *net);
#include <pwd.h>
#endif
-#if !defined(__WIN__)
+#if !defined(_WIN32)
#ifdef HAVE_SELECT_H
# include <select.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
-#endif /* !defined(__WIN__) */
+#endif /* !defined(_WIN32) */
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
-#ifndef _WIN32
-#include <errno.h>
-#define SOCKET_ERROR -1
-#define INVALID_SOCKET -1
-#endif
-#ifdef __WIN__
-#define CONNECT_TIMEOUT 20
-#else
#define CONNECT_TIMEOUT 0
-#endif
#include "client_settings.h"
#include <ssl_compat.h>
@@ -252,7 +243,7 @@ void set_mysql_extended_error(MYSQL *mysql, int errcode,
Create a named pipe connection
*/
-#ifdef __WIN__
+#ifdef _WIN32
HANDLE create_named_pipe(MYSQL *mysql, uint connect_timeout, char **arg_host,
char **arg_unix_socket)
@@ -2596,14 +2587,10 @@ set_connect_attributes(MYSQL *mysql, char *buff, size_t buf_len)
"_platform", MACHINE_TYPE);
rc+= mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
"_server_host", mysql->host);
-#ifdef __WIN__
- snprintf(buff, buf_len, "%lu", (ulong) GetCurrentProcessId());
-#else
snprintf(buff, buf_len, "%lu", (ulong) getpid());
-#endif
rc+= mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "_pid", buff);
-#ifdef __WIN__
+#ifdef _WIN32
snprintf(buff, buf_len, "%lu", (ulong) GetCurrentThreadId());
rc+= mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "_thread", buff);
#endif
@@ -2624,7 +2611,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *scramble_plugin;
ulong pkt_length;
NET *net= &mysql->net;
-#ifdef __WIN__
+#ifdef _WIN32
HANDLE hPipe=INVALID_HANDLE_VALUE;
#endif
#ifdef HAVE_SYS_UN_H
@@ -2746,21 +2733,19 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
}
mysql->options.protocol=MYSQL_PROTOCOL_SOCKET;
}
-#elif defined(__WIN__)
+#elif defined(_WIN32)
if (!net->vio &&
(mysql->options.protocol == MYSQL_PROTOCOL_PIPE ||
- (host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) ||
- (! have_tcpip && (unix_socket || !host ))))
+ (host && !strcmp(host,LOCAL_HOST_NAMEDPIPE))))
{
if ((hPipe= create_named_pipe(mysql, mysql->options.connect_timeout,
(char**) &host, (char**) &unix_socket)) ==
INVALID_HANDLE_VALUE)
{
DBUG_PRINT("error",
- ("host: '%s' socket: '%s' have_tcpip: %d",
+ ("host: '%s' socket: '%s'",
host ? host : "<null>",
- unix_socket ? unix_socket : "<null>",
- (int) have_tcpip));
+ unix_socket ? unix_socket : "<null>"));
if (mysql->options.protocol == MYSQL_PROTOCOL_PIPE ||
(host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) ||
(unix_socket && !strcmp(unix_socket,MYSQL_NAMEDPIPE)))