Assign the child_pid variable before executing child code

Remove a possible race where the child_pid may not be set before we need
to make use of it.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>