Changeset View
Changeset View
Standalone View
Standalone View
sbin/ping6/ping6.c
Show First 20 Lines • Show All 568 Lines • ▼ Show 20 Lines | #endif | ||||
case 't': | case 't': | ||||
alarmtimeout = strtoul(optarg, &e, 0); | alarmtimeout = strtoul(optarg, &e, 0); | ||||
if ((alarmtimeout < 1) || (alarmtimeout == ULONG_MAX)) | if ((alarmtimeout < 1) || (alarmtimeout == ULONG_MAX)) | ||||
errx(EX_USAGE, "invalid timeout: `%s'", | errx(EX_USAGE, "invalid timeout: `%s'", | ||||
optarg); | optarg); | ||||
if (alarmtimeout > MAXALARM) | if (alarmtimeout > MAXALARM) | ||||
errx(EX_USAGE, "invalid timeout: `%s' > %d", | errx(EX_USAGE, "invalid timeout: `%s' > %d", | ||||
optarg, MAXALARM); | 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; | break; | ||||
#ifdef IPSEC | #ifdef IPSEC | ||||
#ifdef IPSEC_POLICY_IPSEC | #ifdef IPSEC_POLICY_IPSEC | ||||
case 'P': | case 'P': | ||||
options |= F_POLICY; | options |= F_POLICY; | ||||
if (!strncmp("in", optarg, 2)) { | if (!strncmp("in", optarg, 2)) { | ||||
if ((policy_in = strdup(optarg)) == NULL) | if ((policy_in = strdup(optarg)) == NULL) | ||||
errx(1, "strdup"); | errx(1, "strdup"); | ||||
▲ Show 20 Lines • Show All 2,271 Lines • Show Last 20 Lines |