<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:monospace"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 2, 2021 at 6:30 PM Petr Vorel <<a href="mailto:pvorel@suse.cz">pvorel@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">to fix warning:<br>
pthread_cancel/3-1.c:40:13: warning: variable ‘waited_for_cancel_ms’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]<br>
40 | int waited_for_cancel_ms = 0;<br>
<br>
Suggested-by: Martin Doucha <<a href="mailto:mdoucha@suse.cz" target="_blank">mdoucha@suse.cz</a>><br>
Signed-off-by: Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>><br></blockquote><div><br></div><div> Acked-by: Jan Stancek <<a href="mailto:jstancek@redhat.com">jstancek@redhat.com</a>></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
.../conformance/interfaces/pthread_cancel/3-1.c | 16 +++++++++++-----<br>
1 file changed, 11 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c<br>
index 3527d57fd..90500b371 100644<br>
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c<br>
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c<br>
@@ -35,19 +35,25 @@ static void cleanup_func(PTS_ATTRIBUTE_UNUSED void *unused)<br>
} while (after_cancel == 0 && thread_sleep_time < TIMEOUT_MS);<br>
}<br>
<br>
-static void *thread_func(PTS_ATTRIBUTE_UNUSED void *unused)<br>
+static void sleep_loop(void)<br>
{<br>
int waited_for_cancel_ms = 0;<br>
struct timespec cancel_wait_ts = {0, SLEEP_MS*1000000};<br>
<br>
- SAFE_PFUNC(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL));<br>
- pthread_cleanup_push(cleanup_func, NULL);<br>
-<br>
- SAFE_FUNC(sem_post(&sem));<br>
while (waited_for_cancel_ms < TIMEOUT_MS) {<br>
nanosleep(&cancel_wait_ts, NULL);<br>
waited_for_cancel_ms += SLEEP_MS;<br>
}<br>
+}<br>
+<br>
+static void *thread_func(PTS_ATTRIBUTE_UNUSED void *unused)<br>
+{<br>
+ SAFE_PFUNC(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL));<br>
+ pthread_cleanup_push(cleanup_func, NULL);<br>
+<br>
+ SAFE_FUNC(sem_post(&sem));<br>
+<br>
+ sleep_loop();<br>
<br>
/* shouldn't be reached */<br>
printf("Error: cancel never arrived\n");<br>
-- <br>
2.32.0<br>
<br>
<br>
-- <br>
Mailing list info: <a href="https://lists.linux.it/listinfo/ltp" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/ltp</a><br>
</blockquote></div></div>