mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Don't put socket endpoints in a directory
This would only leave an empty directory behind.
This commit is contained in:
@@ -543,13 +543,15 @@ fs::path generate_endpoint_name() {
|
|||||||
alphanumeric_characters + strlen(alphanumeric_characters) - 1,
|
alphanumeric_characters + strlen(alphanumeric_characters) - 1,
|
||||||
std::back_inserter(random_id), 8, rng);
|
std::back_inserter(random_id), 8, rng);
|
||||||
|
|
||||||
candidate_endpoint = fs::temp_directory_path() / "yabridge" /
|
// We'll get rid of the file descriptors immediately after accepting the
|
||||||
(plugin_name + "-" + random_id + ".sock");
|
// sockets, so putting them inside of a subdirectory would only leave
|
||||||
} while (fs::exists(candidate_endpoint));
|
// behind an empty directory
|
||||||
|
std::ostringstream socket_name;
|
||||||
|
socket_name << "yabridge-" << plugin_name << "-" << random_id
|
||||||
|
<< ".sock";
|
||||||
|
|
||||||
// Ensure that the parent directory exists so the socket endpoint can be
|
candidate_endpoint = fs::temp_directory_path() / socket_name.str();
|
||||||
// created there
|
} while (fs::exists(candidate_endpoint));
|
||||||
fs::create_directories(candidate_endpoint.parent_path());
|
|
||||||
|
|
||||||
// TODO: Should probably try creating the endpoint right here and catch any
|
// TODO: Should probably try creating the endpoint right here and catch any
|
||||||
// exceptions since this could technically result in a race condition
|
// exceptions since this could technically result in a race condition
|
||||||
|
|||||||
Reference in New Issue
Block a user