[CRIU] [PATCH] Fix check for open_image() ret

Andrew Vagin avagin at odin.com
Fri May 1 03:50:21 PDT 2015


On Thu, Apr 30, 2015 at 04:25:42PM -0700, Kir Kolyshkin wrote:
> When open_image() was modified to return a pointer rather than an int
> in commit 295090c1, these two checks were overlooked and never fixed.
>

Acked-by: Andrew Vagin <avagin at odin.com>
 
> Signed-off-by: Kir Kolyshkin <kir at openvz.org>
> ---
>  files-reg.c | 2 +-
>  mount.c     | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/files-reg.c b/files-reg.c
> index d7251ec..2a6269b 100644
> --- a/files-reg.c
> +++ b/files-reg.c
> @@ -340,7 +340,7 @@ static int dump_ghost_file(int _fd, u32 id, const struct stat *st, dev_t phys_de
>  	pr_info("Dumping ghost file contents (id %#x)\n", id);
>  
>  	img = open_image(CR_FD_GHOST_FILE, O_DUMP, id);
> -	if (img < 0)
> +	if (!img)
>  		return -1;
>  
>  	gfe.uid = userns_uid(st->st_uid);
> diff --git a/mount.c b/mount.c
> index de2dcd7..d4e2444 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -2199,7 +2199,7 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
>  	char root[PATH_MAX] = ".";
>  
>  	img = open_image(CR_FD_MNTS, O_RSTR, nsid->id);
> -	if (img < 0)
> +	if (!img)
>  		return -1;
>  
>  	if (nsid->id != root_item->ids->mnt_ns_id)
> -- 
> 1.9.3
> 


More information about the CRIU mailing list