Make forking code paths more robust.

Use fflush(NULL) before fork().
Use _exit() instead of exit().

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>