diff options
author | Artemis Tosini <lix@artem.ist> | 2024-05-19 22:07:58 +0000 |
---|---|---|
committer | Artemis Tosini <lix@artem.ist> | 2024-05-19 22:07:58 +0000 |
commit | 5411fbf20467c5dd561048311519056688b1154d (patch) | |
tree | 96f46127cb5c10d16a77633fe836b6858c4b0876 /src/libutil/util.hh | |
parent | 139d31f87658c420622f6880a4bdfee8b522f87c (diff) |
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
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r-- | src/libutil/util.hh | 7 |
1 files changed, 7 insertions, 0 deletions
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 @@ -78,6 +78,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 * immediate child thereof (e.g., `/foo`), this means `/` |