[LTP] [PATCH 1/2] lib: initialize lib|main_pid to zero in the setup_ipc

Cyril Hrubis chrubis@suse.cz
Wed May 14 10:23:33 CEST 2025


Hi!
> I see, and you're right we have to set lib_pid before any real setup.
> 
> Does this change below make sense (based on the v2 I just sent)?
> 
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -144,6 +144,8 @@ static void setup_ipc(void)
>         }
> 
>         memset(results, 0 , size);
> +
> +       results->lib_pid = getpid();
>  }
> 
>  static void cleanup_ipc(void)
> @@ -1933,7 +1935,6 @@ void tst_run_tcases(int argc, char *argv[],
> struct tst_test *self)
> 
>         do_setup(argc, argv);
> 
> -       results->lib_pid = getpid();
>         tst_enable_oom_protection(results->lib_pid);
> 
>         SAFE_SIGNAL(SIGALRM, alarm_handler);

Yes, this should fix it.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list