commit ef01f3c72a195dbce682184c842b81b17d7d7ad1
parent 24bee9c7f4dc887eabb2783f21cbf9734d723d72
Author: Conrad Parker <conrad@metadecks.org>
Date: Wed, 21 Aug 2019 08:11:43 +0800
Merge pull request #31 from mckellyln/master
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
@@ -758,7 +759,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;
@@ -2032,6 +2034,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 */