mingw: wrap SSL_set_(w|r)fd to call _get_osfhandle
SSL_set_fd (and friends) expects a OS file handle on Windows, not a file descriptor as on UNIX(-ish). This patch makes the Windows version of SSL_set_fd behave like the UNIX versions, by calling _get_osfhandle on it's input. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Erik Faye-Lund committed
Oct 19, 2009 at 17:42 UTC
514213bf72cb61725e42440aaf8dd53fa4c33a74
1 file changed
+21
compat/mingw.h
+21
@@ -124,6 +124,27 @@ static inline int waitpid(pid_t pid, int *status, unsigned options)
124
return -1;
125
}
126
127
+#ifndef NO_OPENSSL
128
+#include <openssl/ssl.h>
129
+static inline int mingw_SSL_set_fd(SSL *ssl, int fd)
130
+{
131
+ return SSL_set_fd(ssl, _get_osfhandle(fd));
132
+}
133
+#define SSL_set_fd mingw_SSL_set_fd
134
+
135
+static inline int mingw_SSL_set_rfd(SSL *ssl, int fd)
136
+{
137
+ return SSL_set_rfd(ssl, _get_osfhandle(fd));
138
+}
139
+#define SSL_set_rfd mingw_SSL_set_rfd
140
+
141
+static inline int mingw_SSL_set_wfd(SSL *ssl, int fd)
142
+{
143
+ return SSL_set_wfd(ssl, _get_osfhandle(fd));
144
+}
145
+#define SSL_set_wfd mingw_SSL_set_wfd
146
+#endif
147
+
148
/*
149
* implementations of missing functions
150
*/