# HG changeset patch # User Bruno Haible # Date 1552177722 -3600 # Node ID 2796695e92167fcff79a53e654f4f3352e87c5ee # Parent 53cae2062bf44b01db455ee4c43890b06ea390a9 get-rusage-as, pthread_sigmask tests: Fix -fsanitize=thread findings. * lib/get-rusage-as.c (get_rusage_as): When compiled by "gcc -fsanitize=thread", don't try get_rusage_as_via_setrlimit. * tests/test-pthread_sigmask2.c (main): Clean up the killer_thread before exiting. diff -r 53cae2062bf4 -r 2796695e9216 ChangeLog --- a/ChangeLog Sat Mar 09 21:38:03 2019 -0800 +++ b/ChangeLog Sun Mar 10 01:28:42 2019 +0100 @@ -1,3 +1,11 @@ +2019-03-09 Bruno Haible + + get-rusage-as, pthread_sigmask tests: Fix -fsanitize=thread findings. + * lib/get-rusage-as.c (get_rusage_as): When compiled by + "gcc -fsanitize=thread", don't try get_rusage_as_via_setrlimit. + * tests/test-pthread_sigmask2.c (main): Clean up the killer_thread + before exiting. + 2019-03-09 Jim Meyering test-userspec.c: don't print NULL diff -r 53cae2062bf4 -r 2796695e9216 lib/get-rusage-as.c --- a/lib/get-rusage-as.c Sat Mar 09 21:38:03 2019 -0800 +++ b/lib/get-rusage-as.c Sun Mar 10 01:28:42 2019 +0100 @@ -373,7 +373,7 @@ uintptr_t get_rusage_as (void) { -#if (defined __APPLE__ && defined __MACH__) || defined _AIX || defined __CYGWIN__ || defined __MVS__ /* Mac OS X, AIX, Cygwin, z/OS */ +#if (defined __APPLE__ && defined __MACH__) || defined _AIX || defined __CYGWIN__ || defined __MVS__ || defined __SANITIZE_THREAD__ /* Mac OS X, AIX, Cygwin, z/OS, gcc -fsanitize=thread */ /* get_rusage_as_via_setrlimit() does not work. Prefer get_rusage_as_via_iterator(). */ return get_rusage_as_via_iterator (); diff -r 53cae2062bf4 -r 2796695e9216 tests/test-pthread_sigmask2.c --- a/tests/test-pthread_sigmask2.c Sat Mar 09 21:38:03 2019 -0800 +++ b/tests/test-pthread_sigmask2.c Sun Mar 10 01:28:42 2019 +0100 @@ -84,6 +84,10 @@ before the call to pthread_sigmask() returns." */ ASSERT (sigint_occurred == 1); + /* Clean up the thread. This avoid a "ThreadSanitizer: thread leak" warning + from "gcc -fsanitize=thread". */ + gl_thread_join (killer_thread, NULL); + return 0; }