Add exit status reporting to Minijail.

Things that can fail in the child process before Minijail exec()'s
the sandboxed binary are already logging errors, so this will clarify
what's going on with 'dhcpcd'.

BUG=chrome-os-partner:16569
TEST=minijail0 -- <something with a non-zero exit code>

Change-Id: I88530af2e9a0fc77c002b672d5a1c334ec7506e6
Reviewed-on: https://gerrit.chromium.org/gerrit/39568
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Commit-Ready: Jorge Lucangeli Obes <jorgelo@chromium.org>
diff --git a/libminijail.c b/libminijail.c
index 813dce7..5cccc32 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -1041,12 +1041,18 @@
 	int st;
 	if (waitpid(j->initpid, &st, 0) < 0)
 		return -errno;
+
 	if (!WIFEXITED(st)) {
 		if (WIFSIGNALED(st))
 			warn("child process received signal %d", WTERMSIG(st));
 		return MINIJAIL_ERR_JAIL;
 	}
-	return WEXITSTATUS(st);
+
+	int exit_status = WEXITSTATUS(st);
+	if (exit_status != 0)
+		info("child process exited with status %d", exit_status);
+
+	return exit_status;
 }
 
 void API minijail_destroy(struct minijail *j)