From 4b696836d1516587812b6ce51f41ed825b26e7e8 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 20 Dec 2016 04:04:47 +0000 Subject: [PATCH] Fix hardcoded uses of "/tmp" Closes #1032 --- src/remote.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/remote.cc b/src/remote.cc index 4a2cfc3c..96f86a3f 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -746,8 +746,10 @@ Server::Server(String session_name) bool Server::rename_session(StringView name) { - String old_socket_file = format("/tmp/kakoune/{}/{}", getpwuid(geteuid())->pw_name, m_session); - String new_socket_file = format("/tmp/kakoune/{}/{}", getpwuid(geteuid())->pw_name, name); + String old_socket_file = format("{}/kakoune/{}/{}", tmpdir(), + getpwuid(geteuid())->pw_name, m_session); + String new_socket_file = format("{}/kakoune/{}/{}", tmpdir(), + getpwuid(geteuid())->pw_name, name); if (rename(old_socket_file.c_str(), new_socket_file.c_str()) != 0) return false; @@ -760,7 +762,8 @@ void Server::close_session(bool do_unlink) { if (do_unlink) { - String socket_file = format("/tmp/kakoune/{}/{}", getpwuid(geteuid())->pw_name, m_session); + String socket_file = format("{}/kakoune/{}/{}", tmpdir(), + getpwuid(geteuid())->pw_name, m_session); unlink(socket_file.c_str()); } m_listener->close_fd();