[CRIU] [PATCH] util: Don't swear on interrupted close syscall

Pavel Emelyanov xemul at virtuozzo.com
Thu May 4 06:33:56 PDT 2017


On 05/03/2017 12:16 AM, Cyrill Gorcunov wrote:
> In case of EINTR here the descriptor will be
> closed anyway.

We do we have this EINTR here at all?

> http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
> ---
>  criu/util.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/util.c b/criu/util.c
> index cb1e8fd..f5ed388 100644
> --- a/criu/util.c
> +++ b/criu/util.c
> @@ -183,8 +183,12 @@ int close_safe(int *fd)
>  		ret = close(*fd);
>  		if (!ret)
>  			*fd = -1;
> -		else
> -			pr_perror("Unable to close fd %d", *fd);
> +		else {
> +			if (errno != EINTR)
> +				pr_perror("Unable to close fd %d", *fd);
> +			else
> +				ret = 0, *fd = -1;
> +		}
>  	}
>  
>  	return ret;
> 



More information about the CRIU mailing list