diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 70c93e27ba..9c257f3fb2 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -529,6 +529,13 @@ ErrorOr fchmod(int fd, mode_t mode) return {}; } +ErrorOr fchown(int fd, uid_t uid, gid_t gid) +{ + if (::fchown(fd, uid, gid) < 0) + return Error::from_syscall("fchown"sv, -errno); + return {}; +} + ErrorOr lchown(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 eb429eb1d3..9fa4c43eed 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -114,6 +114,7 @@ ErrorOr chdir(StringView path); ErrorOr fork(); ErrorOr mkstemp(Span pattern); ErrorOr fchmod(int fd, mode_t mode); +ErrorOr fchown(int fd, uid_t, gid_t); ErrorOr rename(StringView old_path, StringView new_path); ErrorOr unlink(StringView path); ErrorOr utime(StringView path, Optional);