d52cec02037a697aae0c76c894cb822e2a431e3e
angie
  Wed Jan 15 11:23:23 2014 -0800
I found that when hgsql's mysql child process exited with an error,hgsql was still exiting with status==0, so the failure did not halt my
script as expected.  Fix: propagate child's exit status after parent
checks that it completed normally (i.e. execvp didn't fail).

diff --git src/hg/lib/sqlProg.c src/hg/lib/sqlProg.c
index 0e4bbbb..ad36554 100644
--- src/hg/lib/sqlProg.c
+++ src/hg/lib/sqlProg.c
@@ -212,22 +212,26 @@
 
 child_id = fork();
 killChildPid = child_id;
 if (child_id == 0)
     {
     execvp(nargv[0], nargv);
     _exit(42);  /* Why 42?  Why not?  Need something user defined that mysql isn't going to return */
     }
 else
     {
     /* Wait until the child process completes, then delete the temp file */
     wait(&returnStatus);
     unlink (defaultFileName);
     if (WIFEXITED(returnStatus))
         {
-        if (WEXITSTATUS(returnStatus) == 42)
+	int childExitStatus = WEXITSTATUS(returnStatus);
+        if (childExitStatus == 42)
             errAbort("sqlExecProgProfile: exec failed");
+	else
+	    // Propagate child's exit status:
+	    _exit(childExitStatus);
         }
     else
         errAbort("sqlExecProgProfile: child process exited with abnormal status %d", returnStatus);
     }
 }