[CRIU] [PATCH] service: service should compile on Ubuntu 14.04

Andrew Vagin avagin at parallels.com
Thu Sep 11 01:50:40 PDT 2014


Pavel, you have asked my why do we need travis-ci:
https://travis-ci.org/avagin/criu/builds/34990525

Tested-by: https://travis-ci.org/avagin/criu/builds/34990769

On Wed, Sep 10, 2014 at 10:46:25AM -0500, Tycho Andersen wrote:
> I'm not quite sure what the difference is (I have gcc 4.8, but there are
> probably also header differences), but when I compile the service on 14.04 I
> get:
> 
>   CC       cr-service.o
> cr-service.c: In function ‘start_page_server_req’:
> cr-service.c:536:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
>    write(start_pipe[1], &ret, sizeof(ret));
>         ^
> cr-service.c:544:6: error: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Werror=unused-result]
>   read(start_pipe[0], &ret, sizeof(ret));
>       ^
> 
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> ---
>  cr-service.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/cr-service.c b/cr-service.c
> index 6ed05c2..d144f47 100644
> --- a/cr-service.c
> +++ b/cr-service.c
> @@ -506,6 +506,7 @@ static int pre_dump_loop(int sk, CriuReq *msg)
>  static int start_page_server_req(int sk, CriuOpts *req)
>  {
>  	int ret, pid, start_pipe[2];
> +	ssize_t count;
>  	bool success = false;
>  	CriuResp resp = CRIU_RESP__INIT;
>  	CriuPageServerInfo ps = CRIU_PAGE_SERVER_INFO__INIT;
> @@ -533,16 +534,20 @@ static int start_page_server_req(int sk, CriuOpts *req)
>  
>  		ret = cr_page_server(true, start_pipe[1]);
>  out_ch:
> -		write(start_pipe[1], &ret, sizeof(ret));
> +		count = write(start_pipe[1], &ret, sizeof(ret));
>  		close(start_pipe[1]);
> +		if (count != sizeof(ret))
> +			exit(1);
>  		exit(0);
>  	}
>  
>  	close(start_pipe[1]);
>  	wait(NULL);
>  	ret = -1;
> -	read(start_pipe[0], &ret, sizeof(ret));
> -	if (ret > 0) {
> +	count = read(start_pipe[0], &ret, sizeof(ret));
> +	if (count != sizeof(ret))
> +		success = false;
> +	else if (ret > 0) {
>  		success = true;
>  		ps.has_pid = true;
>  		ps.pid = ret;
> -- 
> 1.9.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list