libchromeos: Prevent closing known bad fd in Process class.

When using ProcessImpl::BindFd the parent_fd is set to -1. This causes
the process to call close(-1) which will silently fail. This patch
avoids calling close on the parent_fd when it is -1 so we don't issue
a known bad call to close. This makes it easier to debug problems when
running such program with strace.

BUG=None
TEST=Unittests still pass.

Change-Id: I3a69fca21a4ba4a5911897b13a95bdeffd53d3cf
Reviewed-on: https://chromium-review.googlesource.com/288782
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
1 file changed