fixed compile errors
This commit is contained in:
@@ -41,10 +41,12 @@ bool bip_init(void)
|
|||||||
int rv = 0; // return from socket lib calls
|
int rv = 0; // return from socket lib calls
|
||||||
struct sockaddr_in sin = {-1};
|
struct sockaddr_in sin = {-1};
|
||||||
int value = 1;
|
int value = 1;
|
||||||
|
int sock_fd = -1;
|
||||||
|
|
||||||
// assumes that the driver has already been initialized
|
// assumes that the driver has already been initialized
|
||||||
BIP_Socket = socket(AF_INET, SOCK_DGRAM, IPROTO_UDP);
|
sock_fd = socket(AF_INET, SOCK_DGRAM, IPROTO_UDP);
|
||||||
if (BIP_Socket < 0)
|
bip_set_socket(sock_fd);
|
||||||
|
if (sock_fd < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// bind the socket to the local port number and IP address
|
// bind the socket to the local port number and IP address
|
||||||
@@ -52,12 +54,12 @@ bool bip_init(void)
|
|||||||
sin.sin_addr.s_addr = htonl(INADDR_ANY);
|
sin.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
sin.sin_port = htons(bip_get_port());
|
sin.sin_port = htons(bip_get_port());
|
||||||
memset(&(sin.sin_zero), '\0', 8);
|
memset(&(sin.sin_zero), '\0', 8);
|
||||||
rv = bind(BIP_Socket,
|
rv = bind(sock_fd,
|
||||||
(const struct sockaddr*)&sin, sizeof(struct sockaddr));
|
(const struct sockaddr*)&sin, sizeof(struct sockaddr));
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
{
|
{
|
||||||
close(BIP_Socket);
|
close(sock_fd);
|
||||||
BIP_Socket = -1;
|
bip_set_socket(-1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ SRCS = init.c main.c ethernet.c bip-init.c \
|
|||||||
..\..\wp.c \
|
..\..\wp.c \
|
||||||
..\..\arf.c \
|
..\..\arf.c \
|
||||||
..\..\awf.c \
|
..\..\awf.c \
|
||||||
|
..\..\bacfile.c \
|
||||||
..\..\device.c \
|
..\..\device.c \
|
||||||
..\..\ai.c \
|
..\..\ai.c \
|
||||||
..\..\ao.c \
|
..\..\ao.c \
|
||||||
|
|||||||
Reference in New Issue
Block a user