Files
AnyPS5/core/libs/prx/libc/src/Hostname.cpp
T
QRMOE 3eb52310b6 fix(libc): keep the guest hostname independent of the host
AI-assisted: yes. Return AnyPS5 without reading the native machine name, hostname environment or network configuration. Preserve FreeBSD bounded-copy behavior, guest ENAMETOOLONG, null queries and success errno. The final tree passes a complete Windows Release build and guest_hostname/guest_errors repeated five times each on main 5edae3536. No new Linux or title test is claimed.
2026-10-10 14:42:43 -04:00

17 lines
540 B
C++

#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[] = "AnyPS5";
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;
}