diff --git a/src/main.cc b/src/main.cc index d11fa828..938097ce 100644 --- a/src/main.cc +++ b/src/main.cc @@ -29,6 +29,7 @@ #include #include #include +#include using namespace Kakoune; @@ -598,7 +599,7 @@ int main(int argc, char* argv[]) if (parser.get_switch("l")) { - for (auto& file : list_files(format("/tmp/kakoune/{}/", getlogin()))) + for (auto& file : list_files(format("/tmp/kakoune/{}/", getpwuid(geteuid())->pw_name))) write_stdout(format("{}\n", file)); return 0; } diff --git a/src/remote.cc b/src/remote.cc index fd043f9a..1c8795d3 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -411,7 +412,7 @@ static sockaddr_un session_addr(StringView session) { sockaddr_un addr; addr.sun_family = AF_UNIX; - format_to(addr.sun_path, "/tmp/kakoune/{}/{}", getlogin(), session); + format_to(addr.sun_path, "/tmp/kakoune/{}/{}", getpwuid(geteuid())->pw_name, session); return addr; } @@ -631,7 +632,7 @@ Server::Server(String session_name) void Server::close_session() { char socket_file[128]; - format_to(socket_file, "/tmp/kakoune/{}/{}", getlogin(), m_session); + format_to(socket_file, "/tmp/kakoune/{}/{}", getpwuid(geteuid())->pw_name, m_session); unlink(socket_file); m_listener->close_fd(); m_listener.reset();