[CRIU] [PATCH criu] zdtm: reset file position to the begginning of the file in netns-dev

Andrew Vagin avagin at odin.com
Mon Apr 13 08:15:33 PDT 2015


On Mon, Apr 13, 2015 at 06:04:41PM +0300, Pavel Tikhomirov wrote:
> writing to netdev configuration at non zero offset won't be supported:
> 
> ```
> [  301.431638] netns-dev wrote to accept_local when file position was
> not 0! This will not be supported in the future. To silence this
> warning, set kernel.sysctl_writes_strict = -1
> ```
>

Acked-by: Pavel Tikhomirov <ptikhomirov at odin.com>
 
> Signed-off-by: Pavel Tikhomirov <ptikhomirov at odin.com>
> ---
>  test/zdtm/live/static/netns-dev.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/test/zdtm/live/static/netns-dev.c b/test/zdtm/live/static/netns-dev.c
> index d8d68fa..646c110 100644
> --- a/test/zdtm/live/static/netns-dev.c
> +++ b/test/zdtm/live/static/netns-dev.c
> @@ -91,6 +91,12 @@ static int save_and_set(int opt, FILE *fp, struct test_conf *tc) {
>  		return -1;
>  	}
>  
> +	fseek(fp, 0, SEEK_SET);
> +	if (ret)
> +		err("fseek");
> +		return -1;
> +	}
> +
>  	/*
>  	 * Set random value
>  	 */
> @@ -129,6 +135,12 @@ static int check_and_restore(int opt, FILE *fp, struct test_conf *tc) {
>  		return -1;
>  	}
>  
> +	fseek(fp, 0, SEEK_SET);
> +	if (ret)
> +		err("fseek");
> +		return -1;
> +	}
> +
>  	/*
>  	 * Restore opt
>  	 */
> -- 
> 1.9.3
> 


More information about the CRIU mailing list