commit 0ff735c88cef0ac77276abb113478e8864643a80
parent 9bfc13d64b5acb92c6648c696a9d9260fcbecc65
Author: Mark Kelly <mark.kelly@lexisnexisrisk.com>
Date: Tue, 4 Dec 2018 00:45:58 -0500
Set timer value to 0 to stop timer, don't use a nullptr timer
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/xsel.c b/xsel.c
@@ -91,6 +91,7 @@ static int current_alloc = 0;
static long timeout = 0;
static struct itimerval timer;
+static struct itimerval zerot;
#define USEC_PER_SEC 1000000
@@ -757,7 +758,8 @@ wait_selection (Atom selection, Atom request_target)
/* Now that we've received the SelectionNotify event, clear any
* remaining timeout. */
if (timeout > 0) {
- setitimer (ITIMER_REAL, (struct itimerval *)0, (struct itimerval *)0);
+ // setitimer (ITIMER_REAL, (struct itimerval *)0, (struct itimerval *)0);
+ setitimer (ITIMER_REAL, &zerot, (struct itimerval *)0);
}
return retval;
@@ -2031,6 +2033,11 @@ main(int argc, char *argv[])
char * display_name = NULL;
long timeout_ms = 0L;
+ zerot.it_value.tv_sec = 0;
+ zerot.it_value.tv_usec = 0;
+ zerot.it_interval.tv_sec = 0;
+ zerot.it_interval.tv_usec = 0;
+
progname = argv[0];
/* Specify default behaviour based on input and output file types */