[lxc-devel] [PATCH] don't hardcode the path to criu when checking versions

Stéphane Graber stgraber at ubuntu.com
Wed Jun 3 14:35:57 UTC 2015


On Wed, Jun 03, 2015 at 12:13:23AM -0600, Tycho Andersen wrote:
> We use the right path when actually execing criu to checkpoint and restore, but
> when checking versions we didn't. Let's use the right path.
> 
> Reported-by: Dietmar Maurer <dietmar at proxmox.com>
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/criu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/criu.c b/src/lxc/criu.c
> index c331adf..c6b1863 100644
> --- a/src/lxc/criu.c
> +++ b/src/lxc/criu.c
> @@ -223,13 +223,15 @@ static bool criu_version_ok()
>  
>  	if (pid == 0) {
>  		char *args[] = { "criu", "--version", NULL };
> +		char *path;
>  		close(pipes[0]);
>  
>  		close(STDERR_FILENO);
>  		if (dup2(pipes[1], STDOUT_FILENO) < 0)
>  			exit(1);
>  
> -		execv("/usr/local/sbin/criu", args);
> +		path = on_path("criu", NULL);
> +		execv(path, args);
>  		exit(1);
>  	} else {
>  		FILE *f;
> -- 
> 2.1.4
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20150603/b596d7c3/attachment.sig>


More information about the lxc-devel mailing list