# HG changeset patch # User normaldotcom # Date 2010-03-18 23:58:03 # Node ID 5a5939bf5b527e01d871a8443a32fd5b3f612e42 # Parent 8ee4266bf89b48c053ffc6286c7a451101cf1088 # Parent e66e47801d878fce85d6fdc3442e7722dcc04edf Merge diff --git a/src/common/execio.c b/src/common/execio.c --- a/src/common/execio.c +++ b/src/common/execio.c @@ -21,7 +21,9 @@ #include #include +#ifndef _WIN32 #include +#endif #include #include #include @@ -150,7 +152,11 @@ int _execio_checkpid(struct execio *eio) { int childstatus; +#ifdef _WIN32 + waitpid(eio->child, &childstatus, 0); +#else waitpid(eio->child, &childstatus, WNOHANG); +#endif /* perror()? */ return WIFEXITED(childstatus); diff --git a/src/common/misc.c b/src/common/misc.c --- a/src/common/misc.c +++ b/src/common/misc.c @@ -20,7 +20,9 @@ #include "common/misc.h" #include +#include #include +#include char *distren_getcwd() { diff --git a/src/common/remoteio.c b/src/common/remoteio.c --- a/src/common/remoteio.c +++ b/src/common/remoteio.c @@ -23,15 +23,22 @@ #include "asprintf.h" #include +#ifndef _WIN32 #include +#endif #include #include #include #include +#ifdef _WIN32 +#include +#include +#else #include +#endif #include -#ifndef WINDOWS +#ifndef _WIN32 #include #endif @@ -44,7 +51,7 @@ int _remoteio_ssh_read(struct remoteio * int _remoteio_ssh_write(struct remoteio *rem, void *buf, size_t len, size_t *byteswritten); int _remoteio_ssh_close(struct remoteio *rem); -#ifndef WINDOWS +#ifndef _WIN32 int _remoteio_sock_open(struct remoteio *rem, struct remoteio_server *server); int _remoteio_sock_close(struct remoteio *rem); #endif @@ -64,7 +71,7 @@ struct remoteio_method_funcmap funcmap[] { /* [REMOTEIO_METHOD_SSH] */ {REMOTEIO_METHOD_SSH, &_remoteio_ssh_open, &_remoteio_ssh_read, &_remoteio_ssh_write, &_remoteio_ssh_close, "ssh"}, -#ifndef WINDOWS +#ifndef _WIN32 {REMOTEIO_METHOD_UNIX, &_remoteio_sock_open, &_remoteio_sock_read, &_remoteio_sock_write, &_remoteio_sock_close, "unix"}, #endif {REMOTEIO_METHOD_TCP, &_remoteio_tcp_open, &_remoteio_sock_read, &_remoteio_sock_write, &_remoteio_tcp_close, "tcp"}, @@ -277,7 +284,7 @@ int _remoteio_ssh_close(struct remoteio return rtn; } -#ifndef WINDOWS +#ifndef _WIN32 /* local sockets implementation (``named pipes''), unix-only */ @@ -285,6 +292,7 @@ int _remoteio_sock_open(struct remoteio { int sock; struct sockaddr_un sockaddr; + /* The POSIX docs pretty much say that I can't depend on sockpath being able to be longer than some proprietary length. So, if the compiler specifies a long path for RUNSTATEDIR, it could @@ -436,7 +444,12 @@ int _remoteio_tcp_open(struct remoteio * memset(&addrinfo_hints, '\0', sizeof(struct addrinfo)); addrinfo_hints.ai_family = AF_UNSPEC; +#ifdef _WIN32 + /* windows lacks stuff documented in POSIX, I guess :-( */ + addrinfo_hints.ai_flags = 0; +#else addrinfo_hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG; +#endif addrinfo_hints.ai_socktype = SOCK_STREAM; tmp = getaddrinfo(server->hostname, port, &addrinfo_hints, &addrinfo_res);