diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2012-08-03 14:09:06 +0100 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-08-03 14:43:11 +0100 |
commit | 91704f12f85626efd7ffad0b05c83befbd72ef4d (patch) | |
tree | 028acc86211036534656b418e4e8b8735acf2c45 | |
parent | 775311e5803d4aedeee0aed02e9a84fbd8b02ee0 (diff) | |
download | node-startup-controller-91704f12f85626efd7ffad0b05c83befbd72ef4d.tar.gz |
Make legacy app handler refuse invalid shutdown modes
Added code to the register signal handler to refuse any register signal
which is not a combination of NSM_SHUTDOWN_TYPE_NORMAL and
NSM_SHUTDOWN_TYPE_FAST and log an error.
-rw-r--r-- | node-startup-controller/la-handler-service.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/node-startup-controller/la-handler-service.c b/node-startup-controller/la-handler-service.c index 32aa007..85769eb 100644 --- a/node-startup-controller/la-handler-service.c +++ b/node-startup-controller/la-handler-service.c @@ -310,6 +310,17 @@ la_handler_service_handle_register (LAHandler *interface, g_return_val_if_fail (unit != NULL && *unit != '\0', FALSE); g_return_val_if_fail (LA_HANDLER_IS_SERVICE (service), FALSE); + if (shutdown_mode != NSM_SHUTDOWN_TYPE_NORMAL + && shutdown_mode != NSM_SHUTDOWN_TYPE_FAST + && shutdown_mode != NSM_SHUTDOWN_TYPE_NORMAL | NSM_SHUTDOWN_TYPE_FAST) + { + /* the shutdown mode is invalid */ + DLT_LOG (la_handler_context, DLT_LOG_ERROR, + DLT_STRING ("Register called with invalid shutdown mode")); + la_handler_complete_register (interface, invocation); + return TRUE; + } + /* find out if we have a shutdown client for this unit already */ client = g_hash_table_lookup (service->units_to_clients, unit); if (client != NULL) |