If we break, we avoid cut & paste code inside the loop. Need to initialize
ret to 0 for the "no scripts" case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit
ec36ced9446da7e3bf866466d265ee8e18f606c1)
const char *options)
{
char *cmdstr;
- int ret;
+ int ret = 0;
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
struct ctdb_script_list *scripts, *current;
/* return an error if the script failed */
if (ret != 0) {
- DEBUG(DEBUG_ERR,("Event script %s failed with error %d\n", cmdstr, ret));
- if (!from_user && call == CTDB_EVENT_MONITOR) {
- if (ctdb_ctrl_event_script_finished(ctdb) != 0) {
- DEBUG(DEBUG_ERR,(__location__ " Failed to finish event script monitoring\n"));
- talloc_free(tmp_ctx);
- return -1;
- }
- }
-
- talloc_free(tmp_ctx);
- return ret;
+ break;
}
}
}
talloc_free(tmp_ctx);
- return 0;
+ return ret;
}
/* called when child is finished */