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/cli/report.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/cli/report.cpp') diff --git a/src/cli/report.cpp b/src/cli/report.cpp index 56740e25..29c5e06f 100644 --- a/src/cli/report.cpp +++ b/src/cli/report.cpp @@ -637,9 +637,10 @@ static int run_events(const char *dump_dir_name, std::string event = events[i]; 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) { @@ -707,13 +708,7 @@ int run_analyze_event(const char *dump_dir_name) run_state->logging_callback = do_log; int res = run_event_on_dir_name(run_state, dump_dir_name, "analyze"); free_run_event_state(run_state); - - if (res != 0 && res != -1) /* -1 is "nothing was done", here it is ok */ - { - error_msg("Error while running analyze event on '%s'", dump_dir_name); - return 1; - } - return 0; + return res; } -- cgit