Enforce non-zero timer timeout (0 means disabled)

This commit is contained in:
Lubos Dolezel 2020-02-23 23:25:18 +01:00
parent 8c9ce7a18b
commit 24c025368b

View File

@ -217,6 +217,9 @@ evfilt_timer_knote_modify(struct filter *filt, struct knote *kn,
kn->kev.flags = kev->flags;
kn->kev.fflags = kev->fflags;
if (!kn->kev.data)
kn->kev.data = 1;
convert_to_itimerspec(&ts, kn->kev.data, kn->kev.flags & EV_ONESHOT, kn->kev.fflags);
if (timerfd_settime(tfd, 0, &ts, NULL) < 0) {
dbg_printf("timerfd_settime(2): %s", strerror(errno));