Added errno sets where missing in error handling code.