In net_send() check if an raddr struct is set.
This commit is contained in:
parent
e5c6f23cfb
commit
43d5bdfe80
@ -52,7 +52,7 @@ void net_destroy(net_t *n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int net_send(net_t *const n, const char *const buf, const int buf_len) {
|
int net_send(net_t *const n, const char *const buf, const int buf_len) {
|
||||||
if (n->fd == -1)
|
if (n->fd == -1 || n->raddr.sin_addr.s_addr == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (sendto(n->fd, buf, buf_len, 0, (struct sockaddr *)&n->raddr, sizeof(n->raddr)) == -1)
|
if (sendto(n->fd, buf, buf_len, 0, (struct sockaddr *)&n->raddr, sizeof(n->raddr)) == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user