From fb4ffe22c81098b8552b5cc531ab0ba30bfb2bff Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 16 Dec 2021 21:12:23 +0100 Subject: [PATCH] LibCore: Add syscall wrapper for fchmod() --- Userland/Libraries/LibCore/System.cpp | 7 +++++++ Userland/Libraries/LibCore/System.h | 1 + 2 files changed, 8 insertions(+) diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 43f23a4e5d..8defd74759 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -330,6 +330,13 @@ ErrorOr chmod(StringView pathname, mode_t mode) #endif } +ErrorOr fchmod(int fd, mode_t mode) +{ + if (::fchmod(fd, mode) < 0) + return Error::from_syscall("fchmod"sv, -errno); + return {}; +} + ErrorOr chown(StringView pathname, uid_t uid, gid_t gid) { if (!pathname.characters_without_null_termination()) diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index e9ce8f1d7f..46e3dfb302 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -66,5 +66,6 @@ ErrorOr symlink(StringView target, StringView link_path); ErrorOr mkdir(StringView path, mode_t); ErrorOr fork(); ErrorOr mkstemp(Span pattern); +ErrorOr fchmod(int fd, mode_t mode); }