Fix a compiler warning.

The compiler barks about fd being used without potentially being
initialized. We fix this and also make the code more future proof by
ensuring that the file is closed iff it was previously opened,
regardless of the path conditions that led to it being opened.

BUG=chromium:386393
TEST=Package builds.

Change-Id: I5e2a2a5653b5ebe1c1c73e7193d7b226d8b5bd16
Reviewed-on: https://chromium-review.googlesource.com/204628
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
1 file changed