Skip to content

Commit a4fef0b

Browse files
authored
Merge pull request #692 from duke-m/patch-2
getsockname / end of non-void function
2 parents 48f5efa + 35424eb commit a4fef0b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/io/syncsocket.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#ifdef _WIN32
44
#include <winsock2.h>
5+
#include <ws2tcpip.h>
56
typedef SOCKET Socket;
67
#define sa_family_t unsigned int
78
#else
@@ -17,12 +18,13 @@
1718
#define snprintf _snprintf
1819
#endif
1920

20-
/* Assuemd maximum packet size. If ever changing this to something beyond a
21+
/* Assumed maximum packet size. If ever changing this to something beyond a
2122
* 16-bit number, then make sure to change the receive offsets in the data
2223
* structure below. */
2324
#define PACKET_SIZE 65535
2425

2526
/* Error handling varies between POSIX and WinSock. */
27+
MVM_NO_RETURN static void throw_error(MVMThreadContext *tc, int r, char *operation) MVM_NO_RETURN_GCC;
2628
#ifdef _WIN32
2729
#define MVM_IS_SOCKET_ERROR(x) ((x) == SOCKET_ERROR)
2830
static void throw_error(MVMThreadContext *tc, int r, char *operation) {
@@ -402,7 +404,8 @@ MVMint64 socket_getport(MVMThreadContext *tc, MVMOSHandle *h) {
402404
MVMIOSyncSocketData *data = (MVMIOSyncSocketData *)h->body.data;
403405

404406
struct sockaddr_storage name;
405-
int error, len = sizeof(struct sockaddr_storage);
407+
int error;
408+
socklen_t len = sizeof(struct sockaddr_storage);
406409
MVMint64 port = 0;
407410

408411
error = getsockname(data->handle, (struct sockaddr *) &name, &len);

0 commit comments

Comments
 (0)