Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion core/libs/prx/libSceNet/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,12 @@ int APS5_VABI sceNetSocket(const char* name, int family, int type, int protocol)
}
if (!initialize_sockets()) return fail(5);
const NativeSocket native = ::socket(family == NET_AF_INET ? AF_INET : AF_INET6, type, protocol);
if (native == INVALID_NATIVE_SOCKET) return fail(native_error());
if (native == INVALID_NATIVE_SOCKET) {
#ifdef __APPLE__
if (errno == EPROTOTYPE) return fail(NET_EPROTONOSUPPORT);
#endif // __APPLE__
return fail(native_error());
}
#ifdef _WIN32
u_long nonblocking = 1;
if (ioctlsocket(native, FIONBIO, &nonblocking) != 0) {
Expand Down Expand Up @@ -1972,6 +1977,13 @@ int APS5_VABI sceNetInetPton(int af, const char* src, void* dst) {
return fail(NET_EINVAL);
}
const auto convert = [](int family, const std::string& text, unsigned char* address) {
#ifdef __APPLE__
if (family == AF_INET) {
for (std::size_t i = 0; i + 1 < text.size(); ++i) {
if (text[i] == '0' && (i == 0 || text[i - 1] == '.') && text[i + 1] >= '0' && text[i + 1] <= '9') return 0;
}
}
#endif // __APPLE__
#ifdef _WIN32
return InetPtonA(family, text.c_str(), address);
#else
Expand Down
Loading