Browse Source

Improve error message reporting

adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
6b49323f05
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 6
      src/base/utils/random.cpp

6
src/base/utils/random.cpp

@ -39,7 +39,9 @@
#include <Windows.h> #include <Windows.h>
#include <Ntsecapi.h> #include <Ntsecapi.h>
#else // Q_OS_WIN #else // Q_OS_WIN
#include <cerrno>
#include <cstdio> #include <cstdio>
#include <cstring>
#endif #endif
#include <QString> #include <QString>
@ -97,7 +99,7 @@ namespace
: m_randDev {fopen("/dev/urandom", "rb")} : m_randDev {fopen("/dev/urandom", "rb")}
{ {
if (!m_randDev) if (!m_randDev)
qFatal("Failed to open /dev/urandom"); qFatal("Failed to open /dev/urandom. Reason: %s. Error code: %d.\n", std::strerror(errno), errno);
} }
~RandomLayer() ~RandomLayer()
@ -119,7 +121,7 @@ namespace
{ {
result_type buf = 0; result_type buf = 0;
if (fread(&buf, sizeof(buf), 1, m_randDev) != 1) if (fread(&buf, sizeof(buf), 1, m_randDev) != 1)
qFatal("Read /dev/urandom error"); qFatal("Read /dev/urandom error. Reason: %s. Error code: %d.\n", std::strerror(errno), errno);
return buf; return buf;
} }

Loading…
Cancel
Save