9
0
Fork 0

state: handle write-protection in the raw backend

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
This commit is contained in:
Jan Luebbe 2015-07-03 14:34:30 +02:00
parent 0b3fd92ffb
commit cb9695a3ea
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}