Merge "Fix errno handling to avoid being overwritten" am: bc0c48496c
am: 4a79062770

Change-Id: Icb75fb7250d8bffd361bfa8f73f256d5df7e8508