aboutsummaryrefslogtreecommitdiffstats
path: root/common/rdr/RandomStream.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2024-09-10 16:55:32 +0200
committerPierre Ossman <ossman@cendio.se>2024-10-09 13:37:08 +0200
commit40df30d258ebfd24a447fababc649867c24513d8 (patch)
treee29c3abaac640eb1cfe951cae4ce4fe6896c8029 /common/rdr/RandomStream.cxx
parent56b3460aa318b650f12833ba119fa6decb930148 (diff)
downloadtigervnc-40df30d258ebfd24a447fababc649867c24513d8.tar.gz
tigervnc-40df30d258ebfd24a447fababc649867c24513d8.zip
Split SystemException to handle Windows
Windows has (at least) two error namespaces, both errno and GetLastResult(). These overlap, so it is important we keep track of which one we are dealing with. To make things extra problematic, the BSD socket API normally uses errno, but on Windows it has been mapped in to the GetLastResult() namespace. Try to keep better control of this by using separate classes for the namespaces.
Diffstat (limited to 'common/rdr/RandomStream.cxx')
-rw-r--r--common/rdr/RandomStream.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/rdr/RandomStream.cxx b/common/rdr/RandomStream.cxx
index 9813abdd..449a84c0 100644
--- a/common/rdr/RandomStream.cxx
+++ b/common/rdr/RandomStream.cxx
@@ -89,7 +89,7 @@ bool RandomStream::fillBuffer() {
#ifdef RFB_HAVE_WINCRYPT
if (provider) {
if (!CryptGenRandom(provider, availSpace(), (uint8_t*)end))
- throw rdr::SystemException("unable to CryptGenRandom", GetLastError());
+ throw rdr::Win32Exception("unable to CryptGenRandom", GetLastError());
end += availSpace();
} else {
#else
@@ -97,8 +97,8 @@ bool RandomStream::fillBuffer() {
if (fp) {
size_t n = fread((uint8_t*)end, 1, availSpace(), fp);
if (n <= 0)
- throw rdr::SystemException("reading /dev/urandom or /dev/random failed",
- errno);
+ throw rdr::PosixException("reading /dev/urandom or /dev/random failed",
+ errno);
end += n;
} else {
#else