aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2010-05-12 13:08:45 +0200
committerAndreas Schneider <mail@cynapses.org>2010-05-12 13:08:45 +0200
commitda9b2e25f6233a419495933822446adf5736cdef (patch)
tree98413d3321779b3370143f5e7a9c66db8de456f9 /libssh
parentfc508f9494080035626c38e81216314f3137de0a (diff)
downloadlibssh-da9b2e25f6233a419495933822446adf5736cdef.tar.gz
libssh-da9b2e25f6233a419495933822446adf5736cdef.tar.xz
libssh-da9b2e25f6233a419495933822446adf5736cdef.zip
Fixed Windows build warnings.
Diffstat (limited to 'libssh')
-rw-r--r--libssh/misc.c8
-rw-r--r--libssh/poll.c9
-rw-r--r--libssh/socket.c1
3 files changed, 16 insertions, 2 deletions
diff --git a/libssh/misc.c b/libssh/misc.c
index 2b2158f..8cbc017 100644
--- a/libssh/misc.c
+++ b/libssh/misc.c
@@ -35,6 +35,7 @@
#ifdef _WIN32
#define _WIN32_IE 0x0501 //SHGetSpecialFolderPath
#include <winsock2.h> // Must be the first to include
+#include <ws2tcpip.h>
#include <shlobj.h>
#include <direct.h>
#else
@@ -531,7 +532,8 @@ int ssh_mkdir(const char *pathname, mode_t mode) {
* @return The expanded directory, NULL on error.
*/
char *ssh_path_expand_tilde(const char *d) {
- char *h, *r, *p;
+ char *h, *r;
+ const char *p;
size_t ld;
size_t lh = 0;
@@ -543,6 +545,9 @@ char *ssh_path_expand_tilde(const char *d) {
/* handle ~user/path */
p = strchr(d, '/');
if (p != NULL && p > d) {
+#ifdef _WIN32
+ return strdup(d);
+#else
struct passwd *pw;
size_t s = p - d;
char u[128];
@@ -558,6 +563,7 @@ char *ssh_path_expand_tilde(const char *d) {
}
ld = strlen(p);
h = strdup(pw->pw_dir);
+#endif
} else {
ld = strlen(d);
p = (char *) d;
diff --git a/libssh/poll.c b/libssh/poll.c
index 327c9b2..fb88596 100644
--- a/libssh/poll.c
+++ b/libssh/poll.c
@@ -69,7 +69,6 @@ int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
#else /* HAVE_POLL */
-#include <sys/time.h>
#include <sys/types.h>
#ifdef _WIN32
@@ -77,11 +76,13 @@ int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
#define STRICT
#endif
+#include <time.h>
#include <winsock2.h>
#else
#include <sys/select.h>
#include <sys/socket.h>
#include <unistd.h>
+#include <sys/time.h>
#endif
static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
@@ -154,9 +155,15 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
char data[64] = {0};
/* support for POLLHUP */
+#ifdef _WIN32
+ if ((recv(fds[i].fd, data, 64, MSG_PEEK) == -1) &&
+ (errno == WSAESHUTDOWN || errno == WSAECONNRESET ||
+ errno == WSAECONNABORTED || errno == WSAENETRESET)) {
+#else
if ((recv(fds[i].fd, data, 64, MSG_PEEK) == -1) &&
(errno == ESHUTDOWN || errno == ECONNRESET ||
errno == ECONNABORTED || errno == ENETRESET)) {
+#endif
fds[i].revents |= POLLHUP;
} else {
fds[i].revents |= fds[i].events & (POLLIN | POLLRDNORM);
diff --git a/libssh/socket.c b/libssh/socket.c
index 76eaa3f..a8d7605 100644
--- a/libssh/socket.c
+++ b/libssh/socket.c
@@ -27,6 +27,7 @@
#include <stdio.h>
#ifdef _WIN32
#include <winsock2.h>
+#include <ws2tcpip.h>
#else
#include <fcntl.h>
#include <sys/types.h>