ping, ping6: Use setitimer(2) instead of obsolete alarm(3)
Submitted by: Ján Sučan <sucanjan@gmail.com> Differential Revision: https://reviews.freebsd.org/D22103
This commit is contained in:
parent
62ba5c5b47
commit
af0de3ad92
@ -505,7 +505,15 @@ main(int argc, char *const *argv)
|
||||
if (alarmtimeout > MAXALARM)
|
||||
errx(EX_USAGE, "invalid timeout: `%s' > %d",
|
||||
optarg, MAXALARM);
|
||||
alarm((int)alarmtimeout);
|
||||
{
|
||||
struct itimerval itv;
|
||||
|
||||
timerclear(&itv.it_interval);
|
||||
timerclear(&itv.it_value);
|
||||
itv.it_value.tv_sec = (time_t)alarmtimeout;
|
||||
if (setitimer(ITIMER_REAL, &itv, NULL) != 0)
|
||||
err(1, "setitimer");
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
options |= F_VERBOSE;
|
||||
|
@ -574,7 +574,15 @@ main(int argc, char *argv[])
|
||||
if (alarmtimeout > MAXALARM)
|
||||
errx(EX_USAGE, "invalid timeout: `%s' > %d",
|
||||
optarg, MAXALARM);
|
||||
alarm((int)alarmtimeout);
|
||||
{
|
||||
struct itimerval itv;
|
||||
|
||||
timerclear(&itv.it_interval);
|
||||
timerclear(&itv.it_value);
|
||||
itv.it_value.tv_sec = (time_t)alarmtimeout;
|
||||
if (setitimer(ITIMER_REAL, &itv, NULL) != 0)
|
||||
err(1, "setitimer");
|
||||
}
|
||||
break;
|
||||
#ifdef IPSEC
|
||||
#ifdef IPSEC_POLICY_IPSEC
|
||||
|
Loading…
Reference in New Issue
Block a user