};
-int run_event_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+int run_event_init(TALLOC_CTX *mem_ctx, struct run_proc_context *run_proc_ctx,
const char *script_dir, const char *debug_prog,
struct run_event_context **out)
{
return ENOMEM;
}
- ret = run_proc_init(run_ctx, ev, &run_ctx->run_proc_ctx);
- if (ret != 0) {
- talloc_free(run_ctx);
- return ret;
- }
+ run_ctx->run_proc_ctx = run_proc_ctx;
ret = stat(script_dir, &st);
if (ret != 0) {
* @param[out] result New run_event context
* @return 0 on success, errno on error
*/
-int run_event_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+int run_event_init(TALLOC_CTX *mem_ctx, struct run_proc_context *run_proc_ctx,
const char *script_dir, const char *debug_prog,
struct run_event_context **result);
};
struct eventd_context {
+ struct run_proc_context *run_proc_ctx;
struct run_event_context *run_ctx;
/* result of last execution */
return ENOMEM;
}
- ret = run_event_init(ectx, ev, script_dir, debug_script,
+ ret = run_proc_init(ectx, ev, &ectx->run_proc_ctx);
+ if (ret != 0) {
+ talloc_free(ectx);
+ return ret;
+ }
+
+ ret = run_event_init(ectx,
+ ectx->run_proc_ctx,
+ script_dir,
+ debug_script,
&ectx->run_ctx);
if (ret != 0) {
talloc_free(ectx);
{
TALLOC_CTX *mem_ctx;
struct tevent_context *ev;
+ struct run_proc_context *run_proc_ctx;
struct run_event_context *run_ctx;
int ret;
exit(1);
}
- ret = run_event_init(mem_ctx, ev, argv[1], NULL, &run_ctx);
+ ret = run_proc_init(mem_ctx, ev, &run_proc_ctx);
+ if (ret != 0) {
+ fprintf(stderr, "run_proc_init() failed, ret=%d\n", ret);
+ exit(1);
+ }
+
+ ret = run_event_init(mem_ctx, run_proc_ctx, argv[1], NULL, &run_ctx);
if (ret != 0) {
fprintf(stderr, "run_event_init() failed, ret=%d\n", ret);
exit(1);