summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/daemon/MiddleWare.cpp10
-rw-r--r--src/daemon/abrt-handle-crashdump.c2
-rw-r--r--src/include/abrtlib.h4
-rw-r--r--src/lib/run_event.c12
4 files changed, 18 insertions, 10 deletions
diff --git a/src/daemon/MiddleWare.cpp b/src/daemon/MiddleWare.cpp
index a29f2f3d..329c04ab 100644
--- a/src/daemon/MiddleWare.cpp
+++ b/src/daemon/MiddleWare.cpp
@@ -319,6 +319,10 @@ report_status_t Report(const map_crash_data_t& client_report,
l_state.last_line = NULL;
int r = run_event(run_state, dump_dir_name, plugin_name.c_str());
+ if (r == -1)
+ {
+ l_state.last_line = xasprintf("Error: no processing is specified for event '%s'", plugin_name.c_str());
+ }
if (r == 0)
{
at_least_one_reporter_succeeded = true;
@@ -347,9 +351,9 @@ report_status_t Report(const map_crash_data_t& client_report,
{
char *s = (char*)li->data;
/* Need to make a copy: just cutting s at '=' and unsetenv'ing
- * the result would be a bug! s _itself_ is in environment now,
- * we must not modify it there!
- */
+ * the result would be a bug! s _itself_ is in environment now,
+ * we must not modify it there!
+ */
char *name = xstrndup(s, strchrnul(s, '=') - s);
VERB3 log("Unexporting '%s'", name);
unsetenv(name);
diff --git a/src/daemon/abrt-handle-crashdump.c b/src/daemon/abrt-handle-crashdump.c
index c823af51..02463ae9 100644
--- a/src/daemon/abrt-handle-crashdump.c
+++ b/src/daemon/abrt-handle-crashdump.c
@@ -89,6 +89,8 @@ int main(int argc, char **argv)
struct run_event_state *run_state = new_run_event_state();
run_state->logging_callback = do_log;
int r = run_event(run_state, dump_dir_name ? dump_dir_name : ".", event);
+ if (r == -1)
+ error_msg_and_die("No actions are found for event '%s'", event);
free_run_event_state(run_state);
return r;
diff --git a/src/include/abrtlib.h b/src/include/abrtlib.h
index 4d565644..f069d311 100644
--- a/src/include/abrtlib.h
+++ b/src/include/abrtlib.h
@@ -227,6 +227,10 @@ static inline struct run_event_state *new_run_event_state()
{ return (struct run_event_state*)xzalloc(sizeof(struct run_event_state)); }
static inline void free_run_event_state(struct run_event_state *state)
{ free(state); }
+/* Returns exitcode of first failed action, or first nonzero return value
+ * of post_run_callback. If all actions are successful, returns 0.
+ * If no actions were run for the event, returns -1.
+ */
int run_event(struct run_event_state *state, const char *dump_dir_name, const char *event);
char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx);
diff --git a/src/lib/run_event.c b/src/lib/run_event.c
index 23517923..90b7b2f2 100644
--- a/src/lib/run_event.c
+++ b/src/lib/run_event.c
@@ -41,7 +41,7 @@ int run_event(struct run_event_state *state,
setenv("EVENT", event, 1);
/* Read, match, and execute lines from abrt_event.conf */
- int retval = 0;
+ int retval = -1;
struct dump_dir *dd = NULL;
char *line;
while ((line = xmalloc_fgetline(conffile)) != NULL)
@@ -147,13 +147,11 @@ int run_event(struct run_event_state *state,
int status;
waitpid(pid, &status, 0);
- if (status != 0)
- {
- retval = WEXITSTATUS(status);
- if (WIFSIGNALED(status))
- retval = WTERMSIG(status) + 128;
+ retval = WEXITSTATUS(status);
+ if (WIFSIGNALED(status))
+ retval = WTERMSIG(status) + 128;
+ if (retval != 0)
break;
- }
}
if (state->post_run_callback)