From fc3265d2cf2dc11a4f18f77db6fa4473464d1e83 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 5 Dec 2024 00:01:23 +0100 Subject: [PATCH] Don't follow symlinks when checking if file exists --- server/active_runtime.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/active_runtime.cpp b/server/active_runtime.cpp index b518537a..eb46d907 100644 --- a/server/active_runtime.cpp +++ b/server/active_runtime.cpp @@ -66,7 +66,8 @@ static std::filesystem::path backup_name(std::filesystem::path file) static void move_file(const std::filesystem::path & from, const std::filesystem::path & to) { - if (not std::filesystem::exists(from)) + auto from_status = std::filesystem::symlink_status(from); + if (from_status.type() == std::filesystem::file_type::not_found) return; std::filesystem::rename(from, to); }