Index: trunk/Ohana/src/opihi/pcontrol/CheckDoneJob.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/CheckDoneJob.c	(revision 8296)
+++ trunk/Ohana/src/opihi/pcontrol/CheckDoneJob.c	(revision 8424)
@@ -1,15 +1,19 @@
 # include "pcontrol.h"
 
-int CheckDoneJob (Job *job) {
+int CheckDoneJob (Job *job, Host *host) {
   
-  Host *host;
+  int success;
 
-  if (!GetJobOutput ("stdout", (Host *) job[0].host, &job[0].stdout, job[0].stdout_size)) {
-    /* strip off first and last lines */
-    PutJob (job, PCONTROL_JOB_DONE, STACK_BOTTOM);
-    return (FALSE);
-  }
+  ASSERT (host == (Host *) job[0].host, "invalid host");
+  ASSERT (job == (Job *) host[0].job, "invalid job");
 
-  if (!GetJobOutput ("stderr", (Host *) job[0].host, &job[0].stderr, job[0].stderr_size)) {
+  success = TRUE;
+  success &= GetJobOutput ("stdout", host, &job[0].stdout, job[0].stdout_size);
+  success &= GetJobOutput ("stderr", host, &job[0].stderr, job[0].stderr_size);
+
+  if (!success) {
+    // XXX some kind of error?
+    // XXX try again later?
+    PutHost (host, PCONTROL_HOST_BUSY, STACK_BOTTOM);
     PutJob (job, PCONTROL_JOB_DONE, STACK_BOTTOM);
     return (FALSE);
@@ -17,5 +21,7 @@
 
   /* job's state is either EXIT or CRASH (verify?) */
-  host = UnlinkJobAndHost (job);
+  // unlink host & job
+  job[0].host = NULL;
+  host[0].job = NULL;
   PutHost (host, PCONTROL_HOST_DONE, STACK_BOTTOM);
   PutJob (job, job[0].state, STACK_BOTTOM);
