[CRIU] Re: [PATCH cr] show: show a hink instead of BUGON for raw images

Pavel Emelyanov xemul at parallels.com
Wed Aug 8 08:46:30 EDT 2012


On 08/08/2012 04:30 PM, Andrey Vagin wrote:
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  cr-show.c     |   21 +++++++++++++++++++++
>  image.c       |    6 ++++--
>  include/net.h |    2 --
>  net.c         |   10 ----------
>  4 files changed, 25 insertions(+), 14 deletions(-)
> 

> +void show_raw_image(int fd, struct cr_options *opt)
> +{
> +	int ret;
> +	u32 magic;
> +	char ppath[PATH_MAX], lpath[PATH_MAX + 1];
> +
> +	snprintf(ppath, sizeof(ppath), "/proc/self/fd/%d", fd);
> +	ret = readlink(ppath, lpath, sizeof(lpath));

O_O Let's remove this part, OK?

> +	if (ret == -1) {
> +		pr_perror("realink(%s) failed", ppath);
> +		return;
> +	}
> +	lpath[ret] = '\0';
> +
> +	pr_msg("%s is RAW image\n", lpath);
> +	if (read_img(fd, &magic) < 0)
> +		return;
> +
> +	try_hint_magic(magic);
> +}



More information about the CRIU mailing list