Bladeren bron

testcfg: Pass pointer to phtread

Previously the cfg_handle was passed as a number. This works fine on
64-bit platform, but it is problem for 32-bit platform.

Solution is to pass pointer as it type expected for phtread_create.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Jan Friesse 2 maanden geleden
bovenliggende
commit
553d09d377
1 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 3 2
      test/testcfg.c

+ 3 - 2
test/testcfg.c

@@ -51,7 +51,8 @@ static void shutdown_callback(corosync_cfg_handle_t handle, corosync_cfg_shutdow
 
 static void *dispatch_thread(void *arg)
 {
-	corosync_cfg_handle_t handle = (corosync_cfg_handle_t) arg;
+	corosync_cfg_handle_t handle = *(corosync_cfg_handle_t *)arg;
+
 	int res = CS_OK;
 	while (res == CS_OK) {
 		res = corosync_cfg_dispatch(handle, CS_DISPATCH_ONE);
@@ -90,7 +91,7 @@ int main (int argc, char *argv[]) {
 		fprintf(stderr, "corosync_cfg_initialize(1) failed: %d\n", res);
 		return 1;
 	}
-	res = pthread_create(&thread, NULL, dispatch_thread, (void*)cfg_handle1);
+	res = pthread_create(&thread, NULL, dispatch_thread, (void *)&cfg_handle1);
 	if (res != 0) {
 		perror("pthread_create failed");
 		return 1;