1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Merge pull request #1206 from disarray2077/errnofix

Fix errno in Linux
This commit is contained in:
Brian Fiete 2021-11-01 11:53:32 -07:00 committed by GitHub
commit 487ef16efd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -176,9 +176,16 @@ namespace System.Net
[Import("wsock32.lib"), CLink, CallingConvention(.Stdcall)] [Import("wsock32.lib"), CLink, CallingConvention(.Stdcall)]
static extern int32 WSAGetLastError(); static extern int32 WSAGetLastError();
#elif BF_PLATFORM_LINUX
[LinkName("__errno_location")]
static extern int32* _errno();
#elif BF_PLATFORM_MACOS
[LinkName("__error")]
static extern int32* _errno();
#else #else
[CLink] [CLink]
static int32 errno; static int32 errno;
static int32* _errno() => &errno;
#endif #endif
[CLink, CallingConvention(.Stdcall)] [CLink, CallingConvention(.Stdcall)]
@ -258,7 +265,7 @@ namespace System.Net
#if BF_PLATFORM_WINDOWS #if BF_PLATFORM_WINDOWS
return WSAGetLastError(); return WSAGetLastError();
#else #else
return errno; return *_errno();
#endif #endif
} }