1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-03 07:31:00 +01:00

libutil: Propagate error code in createSymlink

This commit is contained in:
Sergei Zimmerman 2025-12-01 03:00:45 +03:00
parent 1cc337bb5f
commit bf7c53f2d3
No known key found for this signature in database

View file

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