From bf7c53f2d3e665720c371167b8934d50e818656b Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Mon, 1 Dec 2025 03:00:45 +0300 Subject: [PATCH] libutil: Propagate error code in createSymlink --- src/libutil/file-system.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libutil/file-system.cc b/src/libutil/file-system.cc index 6b145b343..9e27940c5 100644 --- a/src/libutil/file-system.cc +++ b/src/libutil/file-system.cc @@ -737,11 +737,10 @@ std::filesystem::path makeTempPath(const std::filesystem::path & root, const std void createSymlink(const Path & target, const Path & link) { - try { - std::filesystem::create_symlink(target, link); - } catch (std::filesystem::filesystem_error & e) { - throw SysError("creating symlink '%1%' -> '%2%'", link, target); - } + std::error_code ec; + std::filesystem::create_symlink(target, link, ec); + if (ec) + throw SysError(ec.value(), "creating symlink '%1%' -> '%2%'", link, target); } void replaceSymlink(const std::filesystem::path & target, const std::filesystem::path & link)