summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcus Brinkmann <mb@g10code.com>2006-07-04 12:54:17 +0000
committerMarcus Brinkmann <mb@g10code.com>2006-07-04 12:54:17 +0000
commit46eaf1466294f5141055e91088dbde7e4dbab28b (patch)
treec5f49bde38fc16f1b4c293a1456b9374e63254c1 /src
parent0ca80c22e8fe54b70eb5455017eda3140130db4b (diff)
downloadlibgcrypt-46eaf1466294f5141055e91088dbde7e4dbab28b.tar.gz
2006-07-04 Marcus Brinkmann <marcus@g10code.de>
* ath.c: Avoid warning about double defined type byte and other hacks to let it build for W32 (backported from LIBGCRYPT-1-2-BRANCH).
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/ath.c49
2 files changed, 52 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f437c7bb..5b05554b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
2006-07-04 Marcus Brinkmann <marcus@g10code.de>
+ * ath.c: Avoid warning about double defined type byte and other
+ hacks to let it build for W32 (backported from LIBGCRYPT-1-2-BRANCH).
+
* gcrypt.h: Revert last change, and instead:
[_WIN32 || __WIN32__]: Do not include <sys/socket.h>, but
<winsock2.h> and <ws2tcpip.h>.
diff --git a/src/ath.c b/src/ath.c
index 1742d255..628a6bb2 100644
--- a/src/ath.c
+++ b/src/ath.c
@@ -30,11 +30,14 @@
# include <sys/time.h>
#endif
#include <sys/types.h>
+#ifndef _WIN32
#include <sys/wait.h>
+#endif
#include <errno.h>
#include "ath.h"
+
/* The interface table. */
static struct ath_ops ops;
@@ -227,13 +230,22 @@ ath_write (int fd, const void *buf, size_t nbytes)
ssize_t
+#ifdef _WIN32
+ath_select (int nfd, void *rset, void *wset, void *eset,
+ struct timeval *timeout)
+#else
ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
struct timeval *timeout)
+#endif
{
if (ops_set && ops.select)
return (*ops.select) (nfd, rset, wset, eset, timeout);
else
+#ifdef _WIN32
+ return -1;
+#else
return select (nfd, rset, wset, eset, timeout);
+#endif
}
@@ -243,45 +255,82 @@ ath_waitpid (pid_t pid, int *status, int options)
if (ops_set && ops.waitpid)
return (*ops.waitpid) (pid, status, options);
else
+#ifdef _WIN32
+ return -1;
+#else
return waitpid (pid, status, options);
+#endif
}
int
+#ifdef _WIN32
+ath_accept (int s, void *addr, int *length_ptr)
+#else
ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr)
+#endif
{
if (ops_set && ops.accept)
return (*ops.accept) (s, addr, length_ptr);
else
+#ifdef _WIN32
+ return -1;
+#else
return accept (s, addr, length_ptr);
+#endif
}
int
+#ifdef _WIN32
+ath_connect (int s, void *addr, socklen_t length)
+#else
ath_connect (int s, struct sockaddr *addr, socklen_t length)
+#endif
{
if (ops_set && ops.connect)
return (*ops.connect) (s, addr, length);
else
+#ifdef _WIN32
+ return -1;
+#else
return connect (s, addr, length);
+#endif
}
int
+#ifdef _WIN32
+ath_sendmsg (int s, const void *msg, int flags)
+#else
ath_sendmsg (int s, const struct msghdr *msg, int flags)
+#endif
{
if (ops_set && ops.sendmsg)
return (*ops.sendmsg) (s, msg, flags);
else
+#ifdef _WIN32
+ return -1;
+#else
return sendmsg (s, msg, flags);
+#endif
}
int
+#ifdef _WIN32
+ath_recvmsg (int s, void *msg, int flags)
+#else
ath_recvmsg (int s, struct msghdr *msg, int flags)
+#endif
{
if (ops_set && ops.recvmsg)
return (*ops.recvmsg) (s, msg, flags);
else
+#ifdef _WIN32
+ return -1;
+#else
return recvmsg (s, msg, flags);
+#endif
}
+