aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2015-10-18 09:28:10 -0500
committerBrent Cook <bcook@openbsd.org>2015-10-18 09:28:10 -0500
commit0197a589691274055e3a6f47a3652a6714d676bc (patch)
tree9a2c16f2cb86605522ce747c1a71bfd0c23db389 /include
parentc8918dd0be1bbadfcebfc6631bd63f3b3e83befd (diff)
downloadportable-0197a589691274055e3a6f47a3652a6714d676bc.tar.gz
portable-0197a589691274055e3a6f47a3652a6714d676bc.tar.bz2
portable-0197a589691274055e3a6f47a3652a6714d676bc.zip
Windows compatibility fixes
VS2013 has trouble with relative include paths for apps/openssl, so move certhash_win/apps_win.c back to apps/openssl. gmtime_r on mingw64 fails with negative time_t, override gmtime_s fails all of the time unit tests, override SHUT_RD/WR are defined in newer mingw64 headers, check before overriding
Diffstat (limited to 'include')
-rw-r--r--include/compat/time.h6
-rw-r--r--include/compat/win32netcompat.h11
2 files changed, 13 insertions, 4 deletions
diff --git a/include/compat/time.h b/include/compat/time.h
index 9ed9c03..99a2001 100644
--- a/include/compat/time.h
+++ b/include/compat/time.h
@@ -9,11 +9,15 @@
9#else 9#else
10#include <../include/time.h> 10#include <../include/time.h>
11#endif 11#endif
12#define gmtime_r(tp, tm) ((gmtime_s((tm), (tp)) == 0) ? (tm) : NULL)
13#else 12#else
14#include_next <time.h> 13#include_next <time.h>
15#endif 14#endif
16 15
16#ifdef _WIN32
17struct tm *__gmtime_r(const time_t * t, struct tm * tm);
18#define gmtime_r(tp, tm) __gmtime_r(tp, tm)
19#endif
20
17#ifndef HAVE_TIMEGM 21#ifndef HAVE_TIMEGM
18time_t timegm(struct tm *tm); 22time_t timegm(struct tm *tm);
19#endif 23#endif
diff --git a/include/compat/win32netcompat.h b/include/compat/win32netcompat.h
index 452cfba..933f083 100644
--- a/include/compat/win32netcompat.h
+++ b/include/compat/win32netcompat.h
@@ -11,13 +11,18 @@
11#ifdef _WIN32 11#ifdef _WIN32
12 12
13#include <ws2tcpip.h> 13#include <ws2tcpip.h>
14#include <errno.h>
15#include <unistd.h>
14 16
17#ifndef SHUT_RDWR
15#define SHUT_RDWR SD_BOTH 18#define SHUT_RDWR SD_BOTH
19#endif
20#ifndef SHUT_RD
16#define SHUT_RD SD_RECEIVE 21#define SHUT_RD SD_RECEIVE
22#endif
23#ifndef SHUT_WR
17#define SHUT_WR SD_SEND 24#define SHUT_WR SD_SEND
18 25#endif
19#include <errno.h>
20#include <unistd.h>
21 26
22int posix_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); 27int posix_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
23 28