diff options
Diffstat (limited to 'src/posix_extras.cc')
-rw-r--r-- | src/posix_extras.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/posix_extras.cc b/src/posix_extras.cc index 17fe275..8a63d11 100644 --- a/src/posix_extras.cc +++ b/src/posix_extras.cc @@ -67,6 +67,15 @@ struct stat File::Stat() const { return result; } +void File::ChModAt(const char* const path, const mode_t mode) const { + if (path[0] == '/') { + throw std::invalid_argument("absolute path"); + } + if (fchmodat(fd_, path, mode, 0) == -1) { + throw SystemError(); + } +} + struct stat File::LinkStatAt(const char* const path) const { if (path[0] == '/') { throw std::invalid_argument("absolute path"); |