summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-09-12 23:53:31 +0300
committerunknown <monty@hundin.mysql.fi>2001-09-12 23:53:31 +0300
commit76989cf55c016a9d8619f582f753444241a4d934 (patch)
tree51a09b9e3466647e4386ab24f3c9aa89ff7a93b9 /libmysql
parenta53e8ea0ac4f7d53297b7942febf04e02d8c3b54 (diff)
downloadmariadb-git-76989cf55c016a9d8619f582f753444241a4d934.tar.gz
OS2 patch
Docs/manual.texi: Updated section of how to change the socket file. Changelog for 3.23.43 include/merge.h: Fixed typo include/my_pthread.h: Fixed bug for WIN32 include/myisam.h: Fixed typo include/nisam.h: Fixed typo sql/handler.h: Fixed typo sql/sql_table.cc: Fixed typo sql/unireg.cc: F
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/dll.c22
-rw-r--r--libmysql/libmysql.c21
-rw-r--r--libmysql/net.c4
-rw-r--r--libmysql/violite.c14
4 files changed, 37 insertions, 24 deletions
diff --git a/libmysql/dll.c b/libmysql/dll.c
index 4c952c5889e..d1a23794025 100644
--- a/libmysql/dll.c
+++ b/libmysql/dll.c
@@ -110,3 +110,25 @@ int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize,
}
#endif
+
+#ifdef OS2
+
+//
+// This function is called automatically by _DLL_InitTerm
+// Every dll runtime enviroment is not tz enabled, so tzset()
+// must be called to enable TZ handling
+// Also timezone is fixed.
+//
+extern "C" unsigned long _System DllMain(unsigned long modhandle,
+ unsigned long flag)
+{
+ if (flag == 0) {
+ tzset(); // Set tzname
+ time_t currentTime = time(NULL);
+ struct tm *ts = localtime(&currentTime);
+ if (ts->tm_isdst > 0)
+ _timezone -= 3600;
+ }
+}
+
+#endif
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 0cb6170b25c..0e202a4fc08 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -70,11 +70,10 @@ my_string mysql_unix_port=0;
#endif
#if defined(MSDOS) || defined(__WIN__)
-#define ERRNO WSAGetLastError()
+// socket_errno is defined in global.h for all platforms
#define perror(A)
#else
#include <errno.h>
-#define ERRNO errno
#define SOCKET_ERROR -1
#endif /* __WIN__ */
@@ -451,7 +450,7 @@ simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
if (net_write_command(net,(uchar) command,arg,
length ? length : (ulong) strlen(arg)))
{
- DBUG_PRINT("error",("Can't send command to server. Error: %d",errno));
+ DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno));
end_server(mysql);
if (mysql_reconnect(mysql) ||
net_write_command(net,(uchar) command,arg,
@@ -1213,7 +1212,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if ((sock = socket(AF_UNIX,SOCK_STREAM,0)) == SOCKET_ERROR)
{
net->last_errno=CR_SOCKET_CREATE_ERROR;
- sprintf(net->last_error,ER(net->last_errno),ERRNO);
+ sprintf(net->last_error,ER(net->last_errno),socket_errno);
goto error;
}
net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE);
@@ -1223,9 +1222,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (connect2(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr),
mysql->options.connect_timeout) <0)
{
- DBUG_PRINT("error",("Got error %d on connect to local server",ERRNO));
+ DBUG_PRINT("error",("Got error %d on connect to local server",socket_errno));
net->last_errno=CR_CONNECTION_ERROR;
- sprintf(net->last_error,ER(net->last_errno),unix_socket,ERRNO);
+ sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno);
goto error;
}
}
@@ -1276,7 +1275,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if ((sock = (my_socket) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR)
{
net->last_errno=CR_IPSOCK_ERROR;
- sprintf(net->last_error,ER(net->last_errno),ERRNO);
+ sprintf(net->last_error,ER(net->last_errno),socket_errno);
goto error;
}
net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE);
@@ -1313,7 +1312,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (!(hp=gethostbyname(host)))
{
net->last_errno=CR_UNKNOWN_HOST;
- sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, errno);
+ sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno);
goto error;
}
memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
@@ -1323,9 +1322,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (connect2(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
mysql->options.connect_timeout) <0)
{
- DBUG_PRINT("error",("Got error %d on connect to '%s'",ERRNO,host));
+ DBUG_PRINT("error",("Got error %d on connect to '%s'",socket_errno,host));
net->last_errno= CR_CONN_HOST_ERROR;
- sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, ERRNO);
+ sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno);
goto error;
}
}
@@ -1810,7 +1809,7 @@ send_file_to_server(MYSQL *mysql, const char *filename)
if (my_net_write(&mysql->net,"",0) || net_flush(&mysql->net))
{
mysql->net.last_errno=CR_SERVER_LOST;
- sprintf(mysql->net.last_error,ER(mysql->net.last_errno),errno);
+ sprintf(mysql->net.last_error,ER(mysql->net.last_errno),socket_errno);
my_free(tmp_name,MYF(0));
DBUG_RETURN(-1);
}
diff --git a/libmysql/net.c b/libmysql/net.c
index ba0944a2516..24e4da3561a 100644
--- a/libmysql/net.c
+++ b/libmysql/net.c
@@ -77,7 +77,7 @@ extern ulong mysqld_net_retry_count;
typedef my_bool thr_alarm_t;
typedef my_bool ALARM;
#define thr_alarm_init(A) (*(A))=0
-#define thr_alarm_in_use(A) (*(A))
+#define thr_alarm_in_use(A) (*(A)!= 0)
#define thr_end_alarm(A)
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
@@ -372,7 +372,7 @@ net_real_write(NET *net,const char *packet,ulong len)
#endif /* EXTRA_DEBUG */
}
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
- if (vio_errno(net->vio) == EINTR)
+ if (vio_errno(net->vio) == SOCKET_EINTR)
{
DBUG_PRINT("warning",("Interrupted write. Retrying..."));
continue;
diff --git a/libmysql/violite.c b/libmysql/violite.c
index aff4224e5a3..0d96c71969c 100644
--- a/libmysql/violite.c
+++ b/libmysql/violite.c
@@ -44,18 +44,10 @@
#endif /* defined(__EMX__) */
#if defined(MSDOS) || defined(__WIN__)
-#ifdef __WIN__
-#undef errno
-#undef EINTR
-#undef EAGAIN
-#define errno WSAGetLastError()
-#define EINTR WSAEINTR
-#define EAGAIN WSAEINPROGRESS
-#endif /* __WIN__ */
#define O_NONBLOCK 1 /* For emulation of fcntl() */
#endif
#ifndef EWOULDBLOCK
-#define EWOULDBLOCK EAGAIN
+#define SOCKET_EWOULDBLOCK SOCKET_EAGAIN
#endif
#ifndef __WIN__
@@ -327,8 +319,8 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive)
my_bool
vio_should_retry(Vio * vio __attribute__((unused)))
{
- int en = errno;
- return en == EAGAIN || en == EINTR || en == EWOULDBLOCK;
+ int en = socket_errno;
+ return en == SOCKET_EAGAIN || en == SOCKET_EINTR || en == SOCKET_EWOULDBLOCK;
}