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

Pavel Tikhomirov ptikhomirov at odin.com
Mon Apr 13 08:21:30 PDT 2015


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
```

v2: fix compilation

Sorry, please don't consider v1.

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..4d7fede 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;
 	}
 
+	ret = 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;
 	}
 
+	ret = fseek(fp, 0, SEEK_SET);
+	if (ret) {
+		err("fseek");
+		return -1;
+	}
+
 	/*
 	 * Restore opt
 	 */
-- 
1.9.3



More information about the CRIU mailing list