[PATCH] sna: avoid negative timeouts

Felipe Contreras felipe.contreras at gmail.com
Wed Oct 2 23:29:29 PDT 2013


It's nice to avoid X server crashes (by not passing negative values to
select(3)).

For more information:
http://article.gmane.org/gmane.comp.freedesktop.xorg.devel/37388

Signed-off-by: Felipe Contreras <felipe.contreras at gmail.com>
---
 src/sna/sna_accel.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 4838371..ce6da7d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -15978,6 +15978,9 @@ void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
 		     __FUNCTION__, sna->timer_active));
 
 		timeout = sna->timer_expire[0] - TIME;
+		if (timeout < 0)
+			timeout = 0;
+
 		DBG(("%s: flush timer expires in %d [%d]\n",
 		     __FUNCTION__, timeout, sna->timer_expire[0]));
 
-- 
1.8.4-fc



More information about the xorg-devel mailing list