1919#if !defined(WIN32 )
2020#include <unistd.h>
2121#include <sys/wait.h>
22+ #include <time.h>
2223#else
2324#include <process.h>
2425#include <io.h>
@@ -73,7 +74,7 @@ stub_gone_marker_path(void)
7374{
7475 static char path [300 ];
7576
76- lws_snprintf (path , sizeof (path ), "/tmp/lws-%s.gone" , STUB_NAME_P3 );
77+ lws_snprintf (path , sizeof (path ), "/tmp/lws-%s.gone" , STUB_NAME_P3 ); // NOSONAR
7778
7879 return path ;
7980}
@@ -253,7 +254,7 @@ static void stub_parent_gone_cb(void *user)
253254 return ;
254255
255256 /* leave a marker so the test can prove this ran in the stub child */
256- lws_snprintf (path , sizeof (path ), "/tmp/lws-%s.gone" , stub_name );
257+ lws_snprintf (path , sizeof (path ), "/tmp/lws-%s.gone" , stub_name ); // NOSONAR
257258 fd = open (path , O_CREAT | O_WRONLY | O_TRUNC , 0600 );
258259 if (fd >= 0 ) {
259260 if (write (fd , & ok , 1 ) < 0 )
@@ -279,7 +280,7 @@ static int run_stub(struct lws_context *cx, const char *stub_name)
279280 sc .stub_name = stub_name ;
280281 sc .uds_path = stub_uds_path (stub_name );
281282 sc .protocols = stub_protocols ;
282- sc .user = (void * )stub_name ;
283+ sc .user = (void * )( uintptr_t ) stub_name ;
283284 sc .parent_gone_cb = stub_parent_gone_cb ;
284285
285286 if (lws_stub_server_init (& sc , secret , extra , sizeof (extra )) < 0 ) {
@@ -594,10 +595,11 @@ phase3(int argc, const char **argv)
594595 */
595596 start = lws_now_usecs ();
596597 while (lws_now_usecs () - start < 10000000 ) { /* 10s */
598+ struct timespec ts = { .tv_nsec = 100 * 1000 * 1000 };
597599 if (gone_marker_present () &&
598600 stat (stub_uds_path (STUB_NAME_P3 ), & st ))
599601 break ;
600- usleep ( 100000 );
602+ nanosleep ( & ts , NULL );
601603 }
602604
603605 if (!gone_marker_present ()) {
0 commit comments