From 5411fbf20467c5dd561048311519056688b1154d Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Sun, 19 May 2024 22:07:58 +0000 Subject: libutil: Create chmodPath function Move the identical static `chmod_` functions in libstore to libutil. the function is called `chmodPath` instead of `chmod` as otherwise it will shadow the standard library chmod in the nix namespace, which is somewhat confusing. Change-Id: I7b5ce379c6c602e3d3a1bbc49dbb70b1ae8f7bad --- src/libutil/util.hh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libutil/util.hh') diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 914d6cce0..14868776c 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -77,6 +77,13 @@ Path absPath(Path path, */ Path canonPath(PathView path, bool resolveSymlinks = false); +/** + * Change the permissions of a path + * Not called `chmod` as it shadows and could be confused with + * `int chmod(char *, mode_t)`, which does not handle errors + */ +void chmodPath(const Path & path, mode_t mode); + /** * @return The directory part of the given canonical path, i.e., * everything before the final `/`. If the path is the root or an -- cgit v1.2.3