From: Andreas Schneider Date: Wed, 9 May 2018 15:52:19 +0000 (+0200) Subject: lib:util: Fix parameter aliasing in tfork test X-Git-Tag: ldb-1.4.0~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f06a0154f5769cb85f6e189eecd78cd7805090a;p=thirdparty%2Fsamba.git lib:util: Fix parameter aliasing in tfork test ../lib/util/tests/tfork.c:483:24: error: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict] ret = pthread_create(&threads[i], ^~~~~~~~~~~ ../lib/util/tests/tfork.c:486:10: (void *)&threads[i]); ~~~~~~~~~~~~~~~~~~~ BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437 Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner --- diff --git a/lib/util/tests/tfork.c b/lib/util/tests/tfork.c index 9bcdc2f3d6d..3c73355b3f0 100644 --- a/lib/util/tests/tfork.c +++ b/lib/util/tests/tfork.c @@ -417,8 +417,7 @@ static void *tfork_thread(void *p) struct tfork *t = NULL; int status; pid_t child; - pthread_t *ptid = (pthread_t *)p; - uint64_t tid; + uint64_t tid = (uint64_t)pthread_self(); uint64_t *result = NULL; int up[2]; ssize_t nread; @@ -429,8 +428,6 @@ static void *tfork_thread(void *p) pthread_exit(NULL); } - tid = (uint64_t)*ptid; - t = tfork_create(); if (t == NULL) { pthread_exit(NULL); @@ -480,7 +477,7 @@ static bool test_tfork_threads(struct torture_context *tctx) #endif for (i = 0; i < num_threads; i++) { - ret = pthread_create(&threads[i], NULL, tfork_thread, &threads[i]); + ret = pthread_create(&threads[i], NULL, tfork_thread, NULL); torture_assert_goto(tctx, ret == 0, ok, done, "pthread_create failed\n"); }