From 058e0d3144b32d048c2a7637447881256e4c9997 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 1 Feb 2011 15:58:44 +0100 Subject: use run_state->children_count == 0 check for "event not conf'd" condition run_event_on_FOO() was returning -1 when it found that not even one program was run on the requested event. Which is not a very natural return value: in many cases this isn't an error. This change makes it return 0 in this case. It is ok since now we have run_state->children_count member which can be checked for 0 by those callers which want to detect this condition. Signed-off-by: Denys Vlasenko --- src/daemon/MiddleWare.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/daemon/MiddleWare.cpp') diff --git a/src/daemon/MiddleWare.cpp b/src/daemon/MiddleWare.cpp index 8b8795a2..906b1464 100644 --- a/src/daemon/MiddleWare.cpp +++ b/src/daemon/MiddleWare.cpp @@ -147,7 +147,7 @@ static mw_result_t CreateCrashReport(const char *dump_dir_name, run_state->logging_callback = do_log_and_update_client; res = run_event_on_dir_name(run_state, dump_dir_name, force ? "reanalyze" : "analyze"); free_run_event_state(run_state); - if (res != 0 && res != -1) /* -1 is "nothing was done", here it is ok */ + if (res != 0) { r = MW_PLUGIN_ERROR; goto ret; @@ -317,9 +317,10 @@ report_status_t Report(crash_data_t *client_report, l_state.last_line = NULL; int r = run_event_on_dir_name(run_state, dump_dir_name, event.c_str()); - if (r == -1) + if (r == 0 && run_state->children_count == 0) { l_state.last_line = xasprintf("Error: no processing is specified for event '%s'", event.c_str()); + r = -1; } if (r == 0) { -- cgit