Files
AnyPS5/core/libs/prx/libc/src/Hostname.cpp
T
Dean c3db979cd3 Merge pull request #10128 from orezraey/fix/libc-gethostname-measured-ps5
fix(libc): report the empty host name measured on a PS5
2026-10-26 22:00:35 +13:00

18 lines
570 B
C++

#include "prx/libc/include/Api.hpp"
#include "prx/libc/include/general/VabiMacros.hpp"
#include <algorithm>
#include <cerrno>
#include <cstddef>
#include <cstring>
extern "C" int APS5_VABI gethostname_nid_postfix(char* name, std::size_t length) {
constexpr char hostname[] = "";
if (name == nullptr) return 0;
const int savedError = errno;
const auto count = std::min(length, sizeof(hostname));
if (count != 0) std::memcpy(name, hostname, count);
if (length < sizeof(hostname)) { errno = 63; return -1; }
errno = savedError;
return 0;
}