From 14fb71b16c507ee1e80941e2dbc2f42dd0f724c0 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 6 Jun 2019 17:37:57 +1000 Subject: [PATCH] Refuse to overwrite an existing session socket --- src/remote.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/remote.cc b/src/remote.cc index 684d99ea..f4123c81 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -823,6 +823,9 @@ bool Server::rename_session(StringView name) String new_socket_file = format("{}/kakoune/{}/{}", tmpdir(), get_user_name(), name); + if (file_exists(new_socket_file)) + return false; + if (rename(old_socket_file.c_str(), new_socket_file.c_str()) != 0) return false;