Skip to content

Commit

Permalink
socket: Local: Don't check exists()
Browse files Browse the repository at this point in the history
- It does not work simply when file really exists, for some reason remove works fine so directly use it.
  • Loading branch information
Royna2544 committed Dec 19, 2024
1 parent 5256c4f commit ca99d3b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/socket/Local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ Context::Local::Local(const std::filesystem::path& path)
: socket_(io_context), acceptor_(io_context), endpoint_(path.string()) {
LOG(INFO) << "Local::Local: Path=" << path;
std::error_code ec;
if (std::filesystem::exists(path, ec)) {
std::filesystem::remove(path, ec);

if (std::filesystem::remove(path, ec)) {
LOG(INFO) << "Removed stale file.";
}
if (ec) {
} else if (ec != std::make_error_code(std::errc::no_such_file_or_directory)) {
LOG(ERROR) << "Cannot remove stale file: " << ec.message();
}
}
Expand Down

0 comments on commit ca99d3b

Please sign in to comment.