[CRIU] [PATCH] test: remap_dead_pid.c: Fix child PID not being printed

Andrei Vagin avagin at virtuozzo.com
Tue Jul 25 01:35:20 MSK 2017


Applied, thanks!

On Thu, Jul 20, 2017 at 06:04:01PM +0300, Vitaly Ostrosablin wrote:
> There's two issues with this code:
> 
> 1. Child task is killed by parent faster, than it could print the line.
> 2. Even if it had time to print it - there would always be 0, because
> it's called from child process.
> 
> Obviously, this print was meant to be in parent process. So, let's move
> it there.
> 
> Signed-off-by: Vitaly Ostrosablin <vostrosablin at virtuozzo.com>
> ---
>  test/zdtm/static/remap_dead_pid.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/test/zdtm/static/remap_dead_pid.c b/test/zdtm/static/remap_dead_pid.c
> index 1ee61a9d0..261c591b7 100644
> --- a/test/zdtm/static/remap_dead_pid.c
> +++ b/test/zdtm/static/remap_dead_pid.c
> @@ -35,12 +35,13 @@ int main(int argc, char **argv)
>  	}
>  
>  	if (pid == 0) {
> -		test_msg("child is %d\n", pid);
>  		/* Child process just sleeps until it is killed. All we need
>  		 * here is a process to open the mountinfo of. */
>  		while(1)
>  			sleep(10);
>  	} else {
> +		test_msg("child is %d\n", pid);
> +
>  		int fd, ret;
>  		char path[PATH_MAX];
>  		pid_t result;
> -- 
> 2.13.3
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list