return 0;\r
}\r
\r
-int get_exit_action(char *service_name, unsigned long *ret, unsigned char *action) {\r
+int get_exit_action(char *service_name, unsigned long *ret, unsigned char *action, bool *default_action) {\r
+ /* Are we returning the default action or a status-specific one? */\r
+ *default_action = ! ret;\r
+\r
/* Get registry */\r
char registry[KEY_LENGTH];\r
if (_snprintf(registry, sizeof(registry), NSSM_REGISTRY "\\%s", service_name, NSSM_REG_EXIT) < 0) {\r
if (! ret) code[0] = '\0';\r
else if (_snprintf(code, sizeof(code), "%lu", *ret) < 0) {\r
RegCloseKey(key);\r
- return get_exit_action(service_name, 0, action);\r
+ return get_exit_action(service_name, 0, action, default_action);\r
}\r
if (RegQueryValueEx(key, code, 0, &type, action, &action_len) != ERROR_SUCCESS) {\r
RegCloseKey(key);\r
/* Try again with * as the key if an exit code was defined */\r
- if (ret) return get_exit_action(service_name, 0, action);\r
+ if (ret) return get_exit_action(service_name, 0, action, default_action);\r
return 0;\r
}\r
\r