Skip to content
Snippets Groups Projects
Commit 271096f2 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

do not crash if service does not exist at stop process

parent c8aada78
No related branches found
No related tags found
No related merge requests found
......@@ -241,9 +241,20 @@ int ssexec_signal(int argc, char const *const *argv, ssexec_t *info)
for (; *argv ; argv++) {
int aresid = service_resolve_array_search(ares, areslen, *argv) ;
if (aresid < 0)
log_die(LOG_EXIT_USER, "service: ", *argv, " not available -- did you parse it?") ;
/** The service may not be supervised, for example serviceB depends on
* serviceA and serviceB by unsupervised by the user. So it will be ignored
* by the function graph_build_service. In this case, the service does not
* exist at array.
*
* At stop process, just ignore it as it already down anyway */
if (aresid < 0) {
if (what && data[1] != 'r' || data[1] != 'h') {
log_warn("service: ", *argv, " not available -- ignoring it?") ;
continue ;
} else {
log_die(LOG_EXIT_USER, "service: ", *argv, " not available -- did you parse it?") ;
}
}
graph_compute_visit(*argv, visit, list, &graph, &napid, requiredby) ;
}
......
......@@ -105,9 +105,16 @@ int ssexec_stop(int argc, char const *const *argv, ssexec_t *info)
for (; n < argc ; n++) {
int aresid = service_resolve_array_search(ares, areslen, argv[n]) ;
if (aresid < 0)
log_die(LOG_EXIT_USER, "service: ", argv[n], " not available -- did you started it?") ;
/** The service may not be supervised, so it will be ignored by the
* function graph_build_service. In this case, the service does not
* exist at array.
*
* This the stop process, just ignore it as it already down anyway */
if (aresid < 0) {
log_warn("service: ", argv[n], " is already stopped or unsupervised -- ignoring it?") ;
continue ;
}
graph_compute_visit(argv[n], visit, list, &graph, &nservice, 1) ;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment