diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-09-03 09:10:14 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-09-04 12:52:53 +0200 |
commit | 0e272178d1887b0ef0ccac61876c6f5e30fea22f (patch) | |
tree | a30f5b4c2b069accc0eafb3d4f9c1ee1f549c8ad /common | |
parent | 2d5636e8c8dca77c0c52924eb931a79ccf731911 (diff) | |
download | tigervnc-0e272178d1887b0ef0ccac61876c6f5e30fea22f.tar.gz tigervnc-0e272178d1887b0ef0ccac61876c6f5e30fea22f.zip |
Add more usage of SystemException
Prefer this exception for failures involving errno as it gives a better
error description.
Diffstat (limited to 'common')
-rw-r--r-- | common/rfb/SSecurityRSAAES.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/rfb/SSecurityRSAAES.cxx b/common/rfb/SSecurityRSAAES.cxx index 5b3a04d2..92b332d6 100644 --- a/common/rfb/SSecurityRSAAES.cxx +++ b/common/rfb/SSecurityRSAAES.cxx @@ -24,6 +24,7 @@ #error "This source should not be compiled without HAVE_NETTLE defined" #endif +#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> @@ -155,7 +156,7 @@ void SSecurityRSAAES::loadPrivateKey() { FILE* file = fopen(keyFile, "rb"); if (!file) - throw Exception("failed to open key file"); + throw rdr::SystemException("failed to open key file", errno); fseek(file, 0, SEEK_END); size_t size = ftell(file); if (size == 0 || size > MaxKeyFileSize) { @@ -166,7 +167,7 @@ void SSecurityRSAAES::loadPrivateKey() std::vector<uint8_t> data(size); if (fread(data.data(), 1, data.size(), file) != size) { fclose(file); - throw Exception("failed to read key"); + throw rdr::SystemException("failed to read key", errno); } fclose(file); |