diff --git a/src/modules/wreck/job.c b/src/modules/wreck/job.c index 15fdfbdc24ac..c8294342ab11 100644 --- a/src/modules/wreck/job.c +++ b/src/modules/wreck/job.c @@ -576,6 +576,7 @@ static void cmb_exec_cb (flux_future_t *f, void *arg) int64_t pid = 0; const char *type = NULL; const char *state = NULL; + int status = 1; const flux_msg_t *msg; flux_t *h = flux_future_get_flux (f); struct wreck_job *job = arg; @@ -585,19 +586,16 @@ static void cmb_exec_cb (flux_future_t *f, void *arg) flux_future_destroy (f); return; } - if (flux_msg_unpack (msg, "{s?s,s?s,s:i}", + if (flux_msg_unpack (msg, "{s?s,s?s,s?i,s:i}", "type", &type, "state", &state, - "pid", &pid) < 0) { + "status", &status, "pid", &pid) < 0) { flux_log_error (h, "cmb_exec_cb: flux_msg_unpack"); flux_future_destroy (f); } if (type && strcmp (type, "io") == 0) spawn_io_cb (h, job, msg); - else if (strcmp (state, "Exited") == 0) { - int status = 1; - if (flux_msg_unpack (msg, "{s:i}", "status", &status) < 0) - flux_log_error (h, "spawn response: failed to unpack exit status"); + else if (state && strcmp (state, "Exited") == 0) { if (WIFSIGNALED (status)) flux_log_error (h, "job%ju: wrexecd: %s", (uintmax_t) job->id,