Просмотр исходного кода

defect 1006
on 64 bit platforms, the timer is not properly cleared resulting in segfaults


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@876 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 20 лет назад
Родитель
Сommit
25061baa5b
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      exec/tlist.c

+ 3 - 2
exec/tlist.c

@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <string.h>
 
 #include "../include/list.h"
 #include "tlist.h"
@@ -133,7 +134,7 @@ void timerlist_del (struct timerlist *timerlist, timer_handle timer_handle)
 {
 	struct timer *timer = (struct timer *)timer_handle;
 
-	*((unsigned int *)timer->handle_addr) = 0;
+	memset (timer->handle_addr, 0, sizeof (struct timer *));
 	/*
 	 * If the next timer after the currently expiring timer because
 	 * timerlist_del is called from a timer handler, get to the enxt
@@ -162,7 +163,7 @@ static void timerlist_pre_dispatch (struct timerlist *timerlist, timer_handle ti
 {
 	struct timer *timer = (struct timer *)timer_handle;
 
-	*((unsigned int *)timer->handle_addr) = 0;
+	memset (timer->handle_addr, 0, sizeof (struct timer *));
 	list_del (&timer->list);
 	list_init (&timer->list);
 	timers_inuse--;