From 0af0c274d345020c8002c42b4dddb854dc78073e Mon Sep 17 00:00:00 2001 From: Astonex Date: Wed, 24 Jul 2013 01:22:45 +0100 Subject: Changed bind() == -1 check to INVALID_SOCK check --- core/network.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/network.c') diff --git a/core/network.c b/core/network.c index fa6c99fc..8c8d8875 100644 --- a/core/network.c +++ b/core/network.c @@ -119,6 +119,10 @@ int init_networking(IP ip ,uint16_t port) /* initialize our socket */ sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + + /* Check for socket error */ + if (sock == INVALID_SOCKET) + return -1; /* Functions to increase the size of the send and receive UDP buffers NOTE: uncomment if necessary */ @@ -146,8 +150,7 @@ int init_networking(IP ip ,uint16_t port) /* Bind our socket to port PORT and address 0.0.0.0 */ ADDR addr = {AF_INET, htons(port), ip}; - if(bind(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1) - return -1; + bind(sock, (struct sockaddr*)&addr, sizeof(addr)); return 0; -- cgit v1.2.3