[CRIU] [PATCH] files: Simplify find_fdinfo_list_entry

Stanislav Kinsbursky skinsbursky at parallels.com
Tue Mar 20 04:00:46 EDT 2012


This function is going to be removed soon.

20.03.2012 11:59, Cyrill Gorcunov пишет:
> Signed-off-by: Cyrill Gorcunov<gorcunov at openvz.org>
> ---
>   files.c |   11 ++++-------
>   1 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/files.c b/files.c
> index 773193f..39d0a83 100644
> --- a/files.c
> +++ b/files.c
> @@ -213,17 +213,14 @@ static int restore_exe_early(struct fdinfo_entry *fe, int fd)
>   struct fdinfo_list_entry *find_fdinfo_list_entry(int pid, int fd, struct fdinfo_desc *fi)
>   {
>   	struct fdinfo_list_entry *fle;
> -	int found = 0;
>
>   	list_for_each_entry(fle,&fi->list, list) {
> -		if (fle->fd == fd&&  fle->pid == pid) {
> -			found = 1;
> -			break;
> -		}
> +		if (fle->fd == fd&&  fle->pid == pid)
> +			return fle;
>   	}
>
> -	BUG_ON(found == 0);
> -	return fle;
> +	BUG_ON(1);
> +	return NULL;
>   }
>
>   static int open_transport_fd(int pid, struct fdinfo_entry *fe,


-- 
Best regards,
Stanislav Kinsbursky



More information about the CRIU mailing list