Skip to content

Commit 3a003ca

Browse files
author
=
committed
disarm timer 2 if tottime is 0
1 parent d13af41 commit 3a003ca

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

hcxdumptool.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4904,22 +4904,17 @@ return true;
49044904
}
49054905
/*===========================================================================*/
49064906
/* TIMER */
4907-
static bool set_timer(void)
4907+
static bool set_timer(intmax_t tottime)
49084908
{
49094909
static struct itimerspec tval1;
4910+
static struct itimerspec tval2;
49104911

49114912
if((fd_timer1 = timerfd_create(CLOCK_BOOTTIME, 0)) < 0) return false;
49124913
tval1.it_value.tv_sec = TIMER1_VALUE_SEC;
49134914
tval1.it_value.tv_nsec = TIMER1_VALUE_NSEC;
49144915
tval1.it_interval.tv_sec = TIMER1_INTERVAL_SEC;
49154916
tval1.it_interval.tv_nsec = TIMER1_INTERVAL_NSEC;
49164917
if(timerfd_settime(fd_timer1, 0, &tval1, NULL) == -1) return false;
4917-
return true;
4918-
}
4919-
/*---------------------------------------------------------------------------*/
4920-
static bool set_timer2(intmax_t tottime)
4921-
{
4922-
static struct itimerspec tval2;
49234918

49244919
if((fd_timer2 = timerfd_create(CLOCK_BOOTTIME, 0)) < 0) return false;
49254920
tval2.it_value.tv_sec = tottime;
@@ -5760,11 +5755,7 @@ while((auswahl = getopt_long(argc, argv, short_options, long_options, &index)) !
57605755
fprintf(stderr, "time out timer must be > 0 minutes\n");
57615756
exit(EXIT_FAILURE);
57625757
}
5763-
if(set_timer2(tottime * 60) == false)
5764-
{
5765-
fprintf(stderr, "failed to set time out timer\n");
5766-
exit(EXIT_FAILURE);
5767-
}
5758+
tottime *= 60;
57685759
break;
57695760

57705761
case HCX_WATCHDOG_MAX:
@@ -6076,7 +6067,7 @@ if(open_socket_tx() == false)
60766067
fprintf(stderr, "failed to open transmit socket\n");
60776068
goto byebye;
60786069
}
6079-
if(set_timer() == false)
6070+
if(set_timer(tottime) == false)
60806071
{
60816072
errorcount++;
60826073
wanteventflag |= EXIT_ON_ERROR;

0 commit comments

Comments
 (0)