1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 06:06:37 +02:00

Rejig of some of the socket stuff. Fixed marking sockets as nonblocking on Windows. Added in a LastError function to keep having to use strerror/GetLastError everywhere.

This commit is contained in:
Adam
2010-09-17 19:20:07 -04:00
parent f71fb6e813
commit 227909e2cf
19 changed files with 106 additions and 127 deletions
+15
View File
@@ -1305,3 +1305,18 @@ void Anope::Unhex(const Anope::string &src, char *dest)
}
dest[destpos] = 0;
}
const Anope::string Anope::LastError()
{
#ifndef _WIN32
return LastError();
#else
char errbuf[513];
DWORD err = GetLastError();
if (!err)
return NULL;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, errbuf, 512, NULL);
return errbuf;
#endif
}