Skip to content

Commit

Permalink
Explicitly set errNo for filesystem_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhantk232 committed Jul 11, 2024
1 parent 749c037 commit e0090fe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/libstore/build/derivation-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ static void movePath(const Path & src, const Path & dst)
try {
fs::permissions(src, st.permissions() | fs::perms::owner_write, permOpts);
} catch (const fs::filesystem_error & e) {
throw SysError("setting permissions on '%s'", src);
throw SysError(e.code().value(), "setting permissions on '%s'", src);
}
}

Expand All @@ -805,7 +805,7 @@ static void movePath(const Path & src, const Path & dst)
try {
fs::permissions(dst, st.permissions(), permOpts);
} catch (const fs::filesystem_error & e) {
throw SysError("setting permissions on '%s'", dst);
throw SysError(e.code().value(), "setting permissions on '%s'", dst);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstore/builtins/buildenv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
continue;
}
} catch (fs::filesystem_error & e) {
throw SysError("getting status of '%1%'", srcFile);
throw SysError(e.code().value(), "getting status of '%1%'", srcFile);
}

/* The files below are special-cased to that they don't show
Expand Down
2 changes: 1 addition & 1 deletion src/libstore/optimise-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void makeWritable(const Path & path)
std::filesystem::permissions(path, writePerms);
}
catch (std::filesystem::filesystem_error &e) {
throw SysError("changing writability of '%1%'", path);
throw SysError(e.code().value(), "changing writability of '%1%'", path);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/libutil/file-system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ std::optional<fs::file_status> maybeSymlinkStat(const fs::path & path)
return std::nullopt;
return st;
} catch (fs::filesystem_error & e) {
throw SystemError("getting status of '%s'", path);
throw SystemError(e.code().value(), "getting status of '%s'", path);
}
}

Expand Down Expand Up @@ -424,7 +424,7 @@ void createDirs(const Path & path)
try {
fs::create_directories(path);
} catch (fs::filesystem_error & e) {
throw SysError("creating directory '%1%'", path);
throw SysError(e.code().value(), "creating directory '%1%'", path);
}
}

Expand Down

0 comments on commit e0090fe

Please sign in to comment.