errno is not thread-safe on Win32, therefore use something else.