X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f3e60952868d5e58b5c091fde675765c8297bf70..0240e8b1aa935d43689b0b8ec36de3c06c1a4758:/src/unix/gsocket.c diff --git a/src/unix/gsocket.c b/src/unix/gsocket.c index 74121ebb4e..d22b5bf23f 100644 --- a/src/unix/gsocket.c +++ b/src/unix/gsocket.c @@ -11,18 +11,25 @@ #if wxUSE_SOCKETS #include -#include #include -#ifdef vms +#include +#include +#ifdef __VMS__ +#define SOCK_LEN_TYP (unsigned int*) #include +struct sockaddr_un { + u_char sun_len; /* sockaddr len including null */ + u_char sun_family; /* AF_UNIX */ + char sun_path[108]; /* path name (gag) */ +}; #else #include -#endif #include +#define SOCK_LEN_TYP (int*) +#endif #include #include #include -#include #include #include @@ -218,7 +225,7 @@ GAddress *GSocket_GetLocal(GSocket *socket) size = sizeof(addr); - if (getsockname(socket->m_fd, &addr, &size) < 0) { + if (getsockname(socket->m_fd, &addr, SOCK_LEN_TYP &size) < 0) { socket->m_error = GSOCK_IOERR; return NULL; } @@ -485,12 +492,10 @@ GSocketError GSocket_Connect(GSocket *sck, GSocketStream stream) close(sck->m_fd); sck->m_fd = -1; /* sck->m_error is set in _GSocket_Output_Timeout */ - fprintf(stderr, "Blocking connect timeouts\n"); return GSOCK_TIMEDOUT; } else { - fprintf(stderr, "Blocking connect OK\n"); return GSOCK_NOERROR; } } @@ -505,7 +510,6 @@ GSocketError GSocket_Connect(GSocket *sck, GSocketStream stream) { sck->m_error = GSOCK_WOULDBLOCK; sck->m_establishing = TRUE; - fprintf(stderr, "Nonblocking connect in progress\n"); return GSOCK_WOULDBLOCK; } @@ -517,11 +521,9 @@ GSocketError GSocket_Connect(GSocket *sck, GSocketStream stream) sck->m_fd = -1; sck->m_error = GSOCK_IOERR; - fprintf(stderr, "Connect failed (generic err)\n"); return GSOCK_IOERR; } - fprintf(stderr, "Connect OK\n"); return GSOCK_NOERROR; } @@ -804,7 +806,8 @@ int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size) fromlen = sizeof(from); MASK_SIGNAL(); - ret = recvfrom(socket->m_fd, buffer, size, 0, &from, &fromlen); + ret = recvfrom(socket->m_fd, buffer, size, 0, &from, + SOCK_LEN_TYP &fromlen); UNMASK_SIGNAL(); if (ret == -1) @@ -906,7 +909,8 @@ void _GSocket_Detected_Write(GSocket *socket) socket->m_establishing = FALSE; len = sizeof(error); - getsockopt(socket->m_fd, SOL_SOCKET, SO_ERROR, (void*) &error, &len); + getsockopt(socket->m_fd, SOL_SOCKET, SO_ERROR, (void*) &error, + SOCK_LEN_TYP &len); if (error) { @@ -1075,7 +1079,7 @@ GSocketError _GAddress_translate_to(GAddress *address, GSocketError _GAddress_Init_INET(GAddress *address) { address->m_len = sizeof(struct sockaddr_in); - address->m_addr = (struct sockaddr *)malloc(address->m_len)); + address->m_addr = (struct sockaddr *)malloc(address->m_len); if (address->m_addr == NULL) { address->m_error = GSOCK_MEMERR; @@ -1085,7 +1089,11 @@ GSocketError _GAddress_Init_INET(GAddress *address) address->m_family = GSOCK_INET; address->m_realfamily = PF_INET; ((struct sockaddr_in *)address->m_addr)->sin_family = AF_INET; - ((struct sockaddr_in *)address->m_addr)->sin_addr.s_addr = INADDR_ANY; + /* + INADDR_BROADCAST is identical to INADDR_NONE which is not defined + on all unices. INADDR_BROADCAST should be fine to indicate an error. + */ + ((struct sockaddr_in *)address->m_addr)->sin_addr.s_addr = INADDR_BROADCAST; return GSOCK_NOERROR; }