Support connecting to other users sessions by using <user>/<session>

This commit is contained in:
Maxime Coste 2016-01-20 22:58:39 +00:00
parent 2bc24d6889
commit 99b4dc9929

View File

@ -415,7 +415,10 @@ static sockaddr_un session_addr(StringView session)
{
sockaddr_un addr;
addr.sun_family = AF_UNIX;
format_to(addr.sun_path, "/tmp/kakoune/{}/{}", getpwuid(geteuid())->pw_name, session);
if (find(session, '/')!= session.end())
format_to(addr.sun_path, "/tmp/kakoune/{}", session);
else
format_to(addr.sun_path, "/tmp/kakoune/{}/{}", getpwuid(geteuid())->pw_name, session);
return addr;
}