Use errno correctly.

Make sure to check errno prior to doing anything
else that can modify it.

Change-Id: Id81ecc2c3fa07c222ab1e2ef6441331a1eaad635
1 file changed