From cb9695a3ead9d62ad1d339409c7b15255d3b10ed Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Fri, 3 Jul 2015 14:34:30 +0200 Subject: [PATCH] state: handle write-protection in the raw backend Signed-off-by: Jan Luebbe --- common/state.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/state.c b/common/state.c index 7076f5764..5097768b8 100644 --- a/common/state.c +++ b/common/state.c @@ -1201,6 +1201,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) @@ -1211,6 +1213,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; }