summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar comex2023-06-25 14:57:34 -0700
committerGravatar comex2023-06-25 15:06:52 -0700
commit4a355699219710d0a9ad620722393b3d9a16d84d (patch)
tree69b5d25adffe30e968bdcd47c367e0c1040c4427
parentssl: rename argument to avoid false positive codespell warning (diff)
downloadyuzu-4a355699219710d0a9ad620722393b3d9a16d84d.tar.gz
yuzu-4a355699219710d0a9ad620722393b3d9a16d84d.tar.xz
yuzu-4a355699219710d0a9ad620722393b3d9a16d84d.zip
Fixes:
- Add missing virtual destructor on `SSLBackend`. - On Windows, filter out `POLLWRBAND` (one of the new flags added) when calling `WSAPoll`, because despite the constant being defined on Windows, passing it calls `WSAPoll` to yield `EINVAL`. - Reduce OpenSSL version requirement to satisfy CI; I haven't tested whether it actually builds (or runs) against 1.1.1, but if not, I'll figure it out. - Change an instance of memcpy to memmove, even though the arguments cannot overlap, to avoid a [strange GCC error](https://github.com/yuzu-emu/yuzu/pull/10912#issuecomment-1606283351).
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/core/hle/service/sockets/sfdnsres.cpp2
-rw-r--r--src/core/hle/service/ssl/ssl_backend.h1
-rw-r--r--src/core/internal_network/network.cpp13
4 files changed, 13 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c44febbc2..bd3808515 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -325,7 +325,7 @@ if (MINGW)
325endif() 325endif()
326 326
327if(ENABLE_OPENSSL) 327if(ENABLE_OPENSSL)
328 find_package(OpenSSL 3.0.0 REQUIRED) 328 find_package(OpenSSL 1.1.1 REQUIRED)
329endif() 329endif()
330 330
331# Please consider this as a stub 331# Please consider this as a stub
diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp
index 1196fb86c..fb8798b42 100644
--- a/src/core/hle/service/sockets/sfdnsres.cpp
+++ b/src/core/hle/service/sockets/sfdnsres.cpp
@@ -96,7 +96,7 @@ static void Append(std::vector<u8>& vec, T t) {
96static void AppendNulTerminated(std::vector<u8>& vec, std::string_view str) { 96static void AppendNulTerminated(std::vector<u8>& vec, std::string_view str) {
97 size_t off = vec.size(); 97 size_t off = vec.size();
98 vec.resize(off + str.size() + 1); 98 vec.resize(off + str.size() + 1);
99 std::memcpy(vec.data() + off, str.data(), str.size()); 99 std::memmove(vec.data() + off, str.data(), str.size());
100} 100}
101 101
102// We implement gethostbyname using the host's getaddrinfo rather than the 102// We implement gethostbyname using the host's getaddrinfo rather than the
diff --git a/src/core/hle/service/ssl/ssl_backend.h b/src/core/hle/service/ssl/ssl_backend.h
index 624e07d41..0dd8d9118 100644
--- a/src/core/hle/service/ssl/ssl_backend.h
+++ b/src/core/hle/service/ssl/ssl_backend.h
@@ -31,6 +31,7 @@ constexpr Result ResultWouldBlock{ErrorModule::SSLSrv, 204};
31 31
32class SSLConnectionBackend { 32class SSLConnectionBackend {
33public: 33public:
34 virtual ~SSLConnectionBackend() {}
34 virtual void SetSocket(std::shared_ptr<Network::SocketBase> socket) = 0; 35 virtual void SetSocket(std::shared_ptr<Network::SocketBase> socket) = 0;
35 virtual Result SetHostName(const std::string& hostname) = 0; 36 virtual Result SetHostName(const std::string& hostname) = 0;
36 virtual Result DoHandshake() = 0; 37 virtual Result DoHandshake() = 0;
diff --git a/src/core/internal_network/network.cpp b/src/core/internal_network/network.cpp
index 39381e06e..0164d12eb 100644
--- a/src/core/internal_network/network.cpp
+++ b/src/core/internal_network/network.cpp
@@ -97,6 +97,8 @@ bool EnableNonBlock(SOCKET fd, bool enable) {
97 97
98Errno TranslateNativeError(int e) { 98Errno TranslateNativeError(int e) {
99 switch (e) { 99 switch (e) {
100 case 0:
101 return Errno::SUCCESS;
100 case WSAEBADF: 102 case WSAEBADF:
101 return Errno::BADF; 103 return Errno::BADF;
102 case WSAEINVAL: 104 case WSAEINVAL:
@@ -421,9 +423,14 @@ short TranslatePollEvents(PollEvents events) {
421 translate(PollEvents::WrBand, POLLWRBAND); 423 translate(PollEvents::WrBand, POLLWRBAND);
422 424
423#ifdef _WIN32 425#ifdef _WIN32
424 if (True(events & PollEvents::Pri)) { 426 short allowed_events = POLLRDBAND | POLLRDNORM | POLLWRNORM;
425 LOG_WARNING(Service, "Winsock doesn't support POLLPRI"); 427 // Unlike poll on other OSes, WSAPoll will complain if any other flags are set on input.
426 } 428 if (result & ~allowed_events) {
429 LOG_DEBUG(Network,
430 "Removing WSAPoll input events 0x{:x} because Windows doesn't support them",
431 result & ~allowed_events);
432 }
433 result &= allowed_events;
427#endif 434#endif
428 435
429 UNIMPLEMENTED_IF_MSG((u16)events != 0, "Unhandled guest events=0x{:x}", (u16)events); 436 UNIMPLEMENTED_IF_MSG((u16)events != 0, "Unhandled guest events=0x{:x}", (u16)events);