eventscript: handle v. unlikely timeout race
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 7 Dec 2009 12:47:23 +0000 (23:17 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 7 Dec 2009 12:47:23 +0000 (23:17 +1030)
If we time out just as the child exits, we currently will report an
uninitialized cb_status field.  Set it to -ETIME as expected.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
server/eventscript.c

index 940b49ec7b44662a76daf67a94e0f79a45e24cf5..f24f13bedc866ab8a16591ebfb9d5aee3f7d0914 100644 (file)
@@ -651,6 +651,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
        if (kill(state->child, 0) != 0) {
                DEBUG(DEBUG_ERR,("Event script child process already dead, errno %s(%d)\n", strerror(errno), errno));
                state->child = 0;
+               state->cb_status = -ETIME;
                talloc_free(state);
                return;
        }