[Orc][LibResolver] Fix GNU/Hurd build (#184470)

GNU/Hurd does not put a PATH_MAX static constraint on path lengths. We can instead check the symlink length.
This commit is contained in:
Samuel Thibault 2026-04-05 20:56:31 +02:00 committed by GitHub
parent 11e7a49a58
commit 9ce30c8dc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -439,11 +439,9 @@ std::optional<std::string> PathResolver::readlinkCached(StringRef Path) {
return Cache;
// If result not in cache - call system function and cache result
char buf[PATH_MAX];
ssize_t len;
if ((len = readlink(Path.str().c_str(), buf, sizeof(buf))) != -1) {
buf[len] = '\0';
std::string s(buf);
SmallString<128> Buf;
if (!sys::fs::readlink(Path, Buf)) {
std::string s(Buf.str());
LibPathCache->insert_link(Path, s);
return s;
}