system/FatalError: use FormatMessage() instead of g_win32_error_message()

This commit is contained in:
Max Kellermann 2014-12-05 00:14:28 +01:00
parent ad4e597f74
commit a838a03412

View File

@ -23,10 +23,6 @@
#include "util/Domain.hxx"
#include "LogV.hxx"
#ifdef HAVE_GLIB
#include <glib.h>
#endif
#include <unistd.h>
#include <stdarg.h>
#include <stdio.h>
@ -83,7 +79,12 @@ FatalSystemError(const char *msg)
{
const char *system_error;
#ifdef WIN32
system_error = g_win32_error_message(GetLastError());
char buffer[256];
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, GetLastError(), 0,
buffer, sizeof(buffer), nullptr);
system_error = buffer;
#else
system_error = strerror(errno);
#endif