From 29d2adb14bb1e9715b1391d2724b281d01ef8d0a Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 19 Oct 2016 14:08:03 +0200 Subject: [PATCH] service: make instance_update() void and unconditionally replace config on update Signed-off-by: Felix Fietkau --- service/instance.c | 12 ++++-------- service/instance.h | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/service/instance.c b/service/instance.c index 10e35ca..bfc0979 100644 --- a/service/instance.c +++ b/service/instance.c @@ -919,25 +919,21 @@ instance_config_move(struct service_instance *in, struct service_instance *in_sr in_src->config = NULL; } -bool +void instance_update(struct service_instance *in, struct service_instance *in_new) { bool changed = instance_config_changed(in, in_new); bool running = in->proc.pending; - if (!changed && running) - return false; - if (!running) { - if (changed) - instance_config_move(in, in_new); + instance_config_move(in, in_new); instance_start(in); } else { - instance_restart(in); + if (changed) + instance_restart(in); instance_config_move(in, in_new); /* restart happens in the child callback handler */ } - return true; } void diff --git a/service/instance.h b/service/instance.h index 1ee0429..6f95a2a 100644 --- a/service/instance.h +++ b/service/instance.h @@ -80,7 +80,7 @@ struct service_instance { void instance_start(struct service_instance *in); void instance_stop(struct service_instance *in); -bool instance_update(struct service_instance *in, struct service_instance *in_new); +void instance_update(struct service_instance *in, struct service_instance *in_new); void instance_init(struct service_instance *in, struct service *s, struct blob_attr *config); void instance_free(struct service_instance *in); void instance_dump(struct blob_buf *b, struct service_instance *in, int debug); -- 2.25.1