[CRIU] [PATCH] zdtm: Fix pthread01 test case

Cyrill Gorcunov gorcunov at openvz.org
Wed Nov 14 15:14:19 EST 2012


 - use pthread_sigmask instead of sigprocmask
 - show_sigset should take the size of dereferenced variable

http://bugzilla.openvz.org/show_bug.cgi?id=2437

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/zdtm/live/static/pthread01.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/zdtm/live/static/pthread01.c b/test/zdtm/live/static/pthread01.c
index 50d381d..0c14683 100644
--- a/test/zdtm/live/static/pthread01.c
+++ b/test/zdtm/live/static/pthread01.c
@@ -33,7 +33,7 @@ static void show_sigset(const sigset_t *s)
 	char buf[1024];
 	size_t i;
 
-	for (i = 0; i < sizeof(s); i++)
+	for (i = 0; i < sizeof(*s); i++)
 		sprintf(&buf[i * 2], "%02x", p[i]);
 	test_msg("sigset: %s\n", buf);
 }
@@ -50,7 +50,7 @@ static void *ch_thread_2(void *arg)
 	sigemptyset(&blk_sigset);
 	sigprocmask(SIG_SETMASK, NULL, &blk_sigset);
 	sigaddset(&blk_sigset, SIGFPE);
-	sigprocmask(SIG_SETMASK, &blk_sigset, NULL);
+	pthread_sigmask(SIG_SETMASK, &blk_sigset, NULL);
 	memcpy(&tls_data.blk_sigset, &blk_sigset, sizeof(tls_data.blk_sigset));
 
 	task_waiter_complete(&t2, 1);
@@ -68,7 +68,7 @@ static void *ch_thread_2(void *arg)
 	} else
 		results_map[4] = 1;
 
-	sigprocmask(SIG_SETMASK, NULL, &new);
+	pthread_sigmask(SIG_SETMASK, NULL, &new);
 	if (memcmp(&tls_data.blk_sigset, &new, sizeof(tls_data.blk_sigset))) {
 		err("Failed to restore blk_sigset in thread 2\n");
 		results_map[6] = -1;
@@ -93,7 +93,7 @@ static void *ch_thread_1(void *arg)
 	sigemptyset(&blk_sigset);
 	sigprocmask(SIG_SETMASK, NULL, &blk_sigset);
 	sigaddset(&blk_sigset, SIGTRAP);
-	sigprocmask(SIG_SETMASK, &blk_sigset, NULL);
+	pthread_sigmask(SIG_SETMASK, &blk_sigset, NULL);
 	memcpy(&tls_data.blk_sigset, &blk_sigset, sizeof(tls_data.blk_sigset));
 
 	task_waiter_complete(&t1, 1);
@@ -112,7 +112,7 @@ static void *ch_thread_1(void *arg)
 		results_map[3] = 1;
 
 	sigemptyset(&new);
-	sigprocmask(SIG_SETMASK, NULL, &new);
+	pthread_sigmask(SIG_SETMASK, NULL, &new);
 	if (memcmp(&tls_data.blk_sigset, &new, sizeof(tls_data.blk_sigset))) {
 		err("Failed to restore blk_sigset in thread 1\n");
 		results_map[5] = -1;
-- 
1.7.7.6



More information about the CRIU mailing list