mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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
98b49d8e1a
commit
2eb6acc277
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355106
|
@ -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 a new issue