[PATCH 1/2] state: handle write-protection in the raw backend

Jan Luebbe jluebbe at debian.org
Thu Jul 30 08:26:22 PDT 2015


Signed-off-by: Jan Luebbe <jluebbe at debian.org>
---
 common/state.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/state.c b/common/state.c
index 1243320..1ff0e24 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1377,6 +1377,8 @@ static int backend_raw_save_one(struct state_backend_raw *backend_raw,
 	if (ret < 0)
 		return ret;
 
+	protect(fd, backend_raw->stride, offset, false);
+
 	if (backend_raw->need_erase) {
 		ret = erase(fd, backend_raw->stride, offset);
 		if (ret)
@@ -1387,6 +1389,8 @@ static int backend_raw_save_one(struct state_backend_raw *backend_raw,
 	if (ret < 0)
 		return ret;
 
+	protect(fd, backend_raw->stride, offset, true);
+
 	return 0;
 }
 
-- 
2.1.4




More information about the barebox mailing list