FEXServerClient: Workaround sun_path 108 byte limit

We really don't want to do this, but in the case that the AF_UNIX path
is longer than the 108-byte limit that sun_path provides we don't really
have a choice. The alternative choice would be to switch /entirely/ away
from AF_UNIX and instead use pipes. We need a bandage fix for now, so
throw the socket in to a temp folder if the path is too long.
This commit is contained in:
Ryan Houdek committed 2026-07-02 16:49:28 -07:00
1 parent a04b0241c2
commit c330da4992
3 files changed
+29 -10

No files matched your search

+6 -1
View File
@@ -228,7 +228,12 @@ bool InitializeServerSocket(bool abstract) {
if (abstract) {
ServerSocketName = FEXServerClient::GetServerSocketName();
} else {
ServerSocketName = FEXServerClient::GetServerSocketPath();
ServerSocketName = FEXServerClient::GetServerSocketPath(false);
if (ServerSocketName.size() > sizeof(sockaddr_un::sun_path) - 1) {
LogMan::Msg::EFmt("Socket path '{}' too large for Unix domain sockets. Moving to tmp", ServerSocketName);
ServerSocketName = FEXServerClient::GetServerSocketPath(true);
}
// Unlink the socket file if it exists
// We are being asked to create a daemon, not error check
// We don't care if this failed or not