aboutsummaryrefslogtreecommitdiff
path: root/backends/rng.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/rng.c')
-rw-r--r--backends/rng.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/backends/rng.c b/backends/rng.c
index 8b8d5a4973..0f2fc11dd8 100644
--- a/backends/rng.c
+++ b/backends/rng.c
@@ -50,6 +50,7 @@ static void rng_backend_prop_set_opened(Object *obj, bool value, Error **errp)
{
RngBackend *s = RNG_BACKEND(obj);
RngBackendClass *k = RNG_BACKEND_GET_CLASS(s);
+ Error *local_err = NULL;
if (value == s->opened) {
return;
@@ -61,12 +62,14 @@ static void rng_backend_prop_set_opened(Object *obj, bool value, Error **errp)
}
if (k->opened) {
- k->opened(s, errp);
+ k->opened(s, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
}
- if (!error_is_set(errp)) {
- s->opened = value;
- }
+ s->opened = true;
}
static void rng_backend_init(Object *obj)