[CRIU] [PATCH 1/3] zdtm: Get dir of init.pid file

Cyrill Gorcunov gorcunov at gmail.com
Wed Mar 2 07:41:37 PST 2016


On Wed, Mar 02, 2016 at 06:22:08PM +0300, Pavel Emelyanov wrote:
> diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
> index bc5c395..78cc91c 100644
> --- a/test/zdtm/lib/ns.c
> +++ b/test/zdtm/lib/ns.c
> @@ -239,7 +239,7 @@ int ns_init(int argc, char **argv)
>  		.sa_flags	= SA_RESTART,
>  	};
>  	int ret, fd, status_pipe = STATUS_FD;
> -	char buf[128];
> +	char buf[128], *x;
>  	pid_t pid;
>  
>  	ret = fcntl(status_pipe, F_SETFD, FD_CLOEXEC);
> @@ -257,6 +257,10 @@ int ns_init(int argc, char **argv)
>  		exit(1);
>  	}
>  
> +	x = malloc(strlen(pidfile) + 3);
> +	sprintf(x, "%sns", pidfile);
> +	pidfile = x;
> +

Are you sure that malloc never fail here?


More information about the CRIU mailing list