launch: clear RELOADING=1 on failed reload
Make sure we send READY=1 even if reloading fails. Otherwise, systemd
will think we are still reloading.
@@ -1302,7 +1302,7 @@ static int manager_reload_config(Manager *manager) {
_c_cleanup_(c_freep) uint32_t *system_console_users = NULL;
size_t n_system_console_users;
Service *service;
- int r;
+ int r, res;
r = sd_notify(false, "RELOADING=1");
if (r < 0)
@@ -1313,11 +1313,11 @@ static int manager_reload_config(Manager *manager) {
r = nss_cache_populate(&nss_cache);
if (r)
- return error_fold(r);
+ goto out;
r = manager_parse_config(manager, &root, &nss_cache);
if (r)
- return error_trace(r);
+ goto out;
r = nss_cache_resolve_system_console_users(&nss_cache,
&system_console_users,
@@ -1327,29 +1327,30 @@ static int manager_reload_config(Manager *manager) {
r = manager_load_services(manager, root, &nss_cache);
if (r)
- return error_trace(r);
+ goto out;
r = manager_load_policy(manager, root, &policy);
if (r)
- return error_trace(r);
+ goto out;
r = manager_remove_services(manager);
if (r)
- return error_trace(r);
+ goto out;
r = manager_set_policy(manager, &policy, system_console_users, n_system_console_users);
if (r)
- return error_trace(r);
+ goto out;
r = manager_add_services(manager);
if (r)
- return error_trace(r);
+ goto out;
- r = sd_notify(false, "READY=1");
- if (r < 0)
- return error_origin(r);
+out:
+ res = sd_notify(false, "READY=1");
+ if (res < 0)
+ return error_origin(res);
- return 0;
+ return error_trace(r);
}
static int manager_connect(Manager *manager) {
