「🔨」 fix: random crash when user skill issue
This commit is contained in:
@ -18,7 +18,8 @@ typedef enum {
|
||||
SIZE,
|
||||
TIMEOUT,
|
||||
LINGER,
|
||||
INTERVAL
|
||||
INTERVAL,
|
||||
TTL
|
||||
} options_nb_t;
|
||||
|
||||
static struct options options[] = {
|
||||
@ -39,7 +40,7 @@ static struct options options[] = {
|
||||
#undef GRP
|
||||
};
|
||||
|
||||
#define OPT_NB 10
|
||||
#define OPT_NB 9
|
||||
|
||||
#define FT_PING_V "0.1"
|
||||
|
||||
|
@ -28,7 +28,7 @@ int init_socket(options_t opt) {
|
||||
linger.l_onoff = true;
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger)) < 0) {
|
||||
fprintf(stderr,
|
||||
"can't setsockopt for the linger maybe try a different one");
|
||||
"can't setsockopt for the linger maybe try a different one\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -38,8 +38,7 @@ int init_socket(options_t opt) {
|
||||
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv_out, sizeof(tv_out)) <
|
||||
0) {
|
||||
perror("setsockopt");
|
||||
fprintf(stderr, "can't setsockopt for the receive timeout");
|
||||
fprintf(stderr, "can't setsockopt for the receive timeout\n");
|
||||
return -1;
|
||||
}
|
||||
return sock;
|
||||
|
@ -41,7 +41,6 @@ options_t init_opt(args_t *args) {
|
||||
opt.interval =
|
||||
args->arg[INTERVAL] != -1 ? args->arg[INTERVAL] : DEFAULT_INTERVAL;
|
||||
opt.linger = args->arg[LINGER] != -1 ? args->arg[LINGER] : DEFAULT_LINGER;
|
||||
|
||||
return opt;
|
||||
}
|
||||
|
||||
@ -76,8 +75,7 @@ int send_ping(int socket, struct sockaddr_in *dest, options_t opt) {
|
||||
}
|
||||
}
|
||||
} else
|
||||
process_icmp(recvbuf, bytes, &addr, seq, &pkt_start,
|
||||
&pkt_end);
|
||||
process_icmp(recvbuf, bytes, &addr, seq, &pkt_start, &pkt_end);
|
||||
if (check_for_count(opt)) {
|
||||
print_stats();
|
||||
return EXIT_SUCCESS;
|
||||
|
Reference in New Issue
Block a user