mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-22 07:15:59 +01:00
Fix crash due to invalid timespec given to pselect
If blinktimeout is set to a value greater than 1000, pselect will receive a timeout argument with tv_nsec greater than 1E9 (1 sec), and fail, making st crash. This patch just ensures that the timespec structure is correctly filled with a value properly decomposed between tv_sec and tv_nsec. Reported by JasonWoof on IRC. Thanks!
This commit is contained in:
parent
09f5d98251
commit
708b697ed7
1 changed files with 3 additions and 0 deletions
3
st.c
3
st.c
|
@ -3922,6 +3922,9 @@ run(void) {
|
||||||
TIMEDIFF(now,
|
TIMEDIFF(now,
|
||||||
lastblink)));
|
lastblink)));
|
||||||
}
|
}
|
||||||
|
drawtimeout.tv_sec = \
|
||||||
|
drawtimeout.tv_nsec / 1E9;
|
||||||
|
drawtimeout.tv_nsec %= (long)1E9;
|
||||||
} else {
|
} else {
|
||||||
tv = NULL;
|
tv = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue