Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157101163
D22103.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D22103.diff
View Options
Index: head/sbin/ping/ping.c
===================================================================
--- head/sbin/ping/ping.c
+++ head/sbin/ping/ping.c
@@ -505,7 +505,15 @@
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;
Index: head/sbin/ping6/ping6.c
===================================================================
--- head/sbin/ping6/ping6.c
+++ head/sbin/ping6/ping6.c
@@ -574,7 +574,15 @@
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
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 19, 11:11 AM (11 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33308917
Default Alt Text
D22103.diff (1 KB)
Attached To
Mode
D22103: ping: Use setitimer(2) instead of obsoleted alarm(3)
Attached
Detach File
Event Timeline
Log In to Comment