From 204f9419baa815d3030ea618ddde5d05525c6c6c Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 25 May 2016 08:58:07 +0100 Subject: win32: correct cast of argument to _open_osfhandle --- win32/net.c | 4 ++-- win32/popen.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/win32/net.c b/win32/net.c index 05df6d20e..2341119b0 100644 --- a/win32/net.c +++ b/win32/net.c @@ -37,7 +37,7 @@ int mingw_socket(int domain, int type, int protocol) return -1; } /* convert into a file descriptor */ - if ((sockfd = _open_osfhandle(s, O_RDWR|O_BINARY)) < 0) { + if ((sockfd = _open_osfhandle((intptr_t)s, O_RDWR|O_BINARY)) < 0) { closesocket(s); bb_error_msg("unable to make a socket file descriptor: %s", strerror(errno)); @@ -90,7 +90,7 @@ int mingw_accept(int sockfd1, struct sockaddr *sa, socklen_t *sz) SOCKET s2 = accept(s1, sa, sz); /* convert into a file descriptor */ - if ((sockfd2 = _open_osfhandle(s2, O_RDWR|O_BINARY)) < 0) { + if ((sockfd2 = _open_osfhandle((intptr_t)s2, O_RDWR|O_BINARY)) < 0) { int err = errno; closesocket(s2); bb_error_msg("unable to make a socket file descriptor: %s", diff --git a/win32/popen.c b/win32/popen.c index 93d51bb55..6b8e52ca9 100644 --- a/win32/popen.c +++ b/win32/popen.c @@ -154,11 +154,11 @@ FILE *mingw_popen(const char *cmd, const char *mode) p->pipe[ic] = INVALID_HANDLE_VALUE; if ( *mode == 'r' ) { - fd = _open_osfhandle((long)p->pipe[ip], _O_RDONLY|_O_BINARY); + fd = _open_osfhandle((intptr_t)p->pipe[ip], _O_RDONLY|_O_BINARY); fptr = _fdopen(fd, "rb"); } else { - fd = _open_osfhandle((long)p->pipe[ip], _O_WRONLY|_O_BINARY); + fd = _open_osfhandle((intptr_t)p->pipe[ip], _O_WRONLY|_O_BINARY); fptr = _fdopen(fd, "wb"); } @@ -252,10 +252,10 @@ int mingw_popen_fd(const char *cmd, const char *mode, int fd0, pid_t *pid) p->pipe[ic] = INVALID_HANDLE_VALUE; if ( *mode == 'r' ) { - fd = _open_osfhandle((long)p->pipe[ip], _O_RDONLY|_O_BINARY); + fd = _open_osfhandle((intptr_t)p->pipe[ip], _O_RDONLY|_O_BINARY); } else { - fd = _open_osfhandle((long)p->pipe[ip], _O_WRONLY|_O_BINARY); + fd = _open_osfhandle((intptr_t)p->pipe[ip], _O_WRONLY|_O_BINARY); } finito: -- cgit v1.2.3-55-g6feb