summaryrefslogtreecommitdiffstats
path: root/common/state
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-05-04 11:59:59 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-02-06 08:45:46 +0100
commit6d3e10c67822816d3ff2021dcfba5e7a83906586 (patch)
tree4dc110bebe8b2c056357a9cac0aa8e50586a1594 /common/state
parent1d8f7f3403366831b37f29361dba8da0e43d82e1 (diff)
downloadbarebox-6d3e10c67822816d3ff2021dcfba5e7a83906586.tar.gz
state: refuse to set dirty parameter via setenv
The dirty parameter is readonly, so refuse to set it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/state')
-rw-r--r--common/state/state.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/state/state.c b/common/state/state.c
index 6399bd3..5a1a1af 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -153,6 +153,11 @@ void state_backend_set_readonly(struct state *state)
state_storage_set_readonly(&state->storage);
}
+static int state_set_deny(struct param_d *p, void *priv)
+{
+ return -EROFS;
+}
+
static struct state *state_new(const char *name)
{
struct state *state;
@@ -172,7 +177,7 @@ static struct state *state_new(const char *name)
}
state->dirty = 1;
- dev_add_param_bool(&state->dev, "dirty", NULL, NULL, &state->dirty,
+ dev_add_param_bool(&state->dev, "dirty", state_set_deny, NULL, &state->dirty,
NULL);
state->save_on_shutdown = 1;
dev_add_param_bool(&state->dev, "save_on_shutdown", NULL, NULL,