Refuse to overwrite an existing session socket

This commit is contained in:
Maxime Coste 2019-06-06 17:37:57 +10:00
parent d2dac558e7
commit 14fb71b16c

View File

@ -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;