add error when sendto fails
This commit is contained in:
@ -67,11 +67,18 @@ t_waitlist *send_icmp(t_settings *set, struct addrinfo *host, uint16_t *seq, str
|
||||
{
|
||||
t_icmp_echo packet;
|
||||
t_waitlist *ret;
|
||||
size_t len;
|
||||
|
||||
if(timediff(last) < set->interval)
|
||||
return (0);
|
||||
packet = prepare_icmp_echo(*seq, set->id);
|
||||
sendto(set->socket, &packet, sizeof(t_icmp_echo), 0, host->ai_addr, host->ai_addrlen);
|
||||
len = sendto(set->socket, &packet, sizeof(t_icmp_echo), 0, host->ai_addr, host->ai_addrlen);
|
||||
if(len == (size_t)-1)
|
||||
{
|
||||
perror(set->name);
|
||||
set->err = 1;
|
||||
g_stop = 1;
|
||||
}
|
||||
gettimeofday(last, 0);
|
||||
ret = malloc(sizeof(t_waitlist));
|
||||
if(!ret)
|
||||
|
Reference in New Issue
Block a user