Handling errors in C

From errno to platform-specific functions