Kill the child process before dying.

We kill the child process if we fail to send the Minijail
configuration over, but we were not killing the child process when
failing to write a pid file, failing to set up cgroups, or failing
to set up uid/gid maps. Kill the child in those cases too.

Use this opportunity to refactor libminijail.c a bit more, extracting
common functions that don't require knowledge of struct minijail to
util.c.

Bug: 30708487

Change-Id: Ie22be97093c4f53e5a57585bfe88ae7b55567fbd
3 files changed