diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2022-06-08 14:39:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-06-09 22:08:04 +0200 |
commit | d288c700c7caedbb2963dddac94a80097fde0798 (patch) | |
tree | 36ff589f2c047169ed162c47223a5e4b26834c65 /Userland/Libraries | |
parent | 348750a9f4fd597276f2160decfe704ead08939e (diff) | |
download | serenity-d288c700c7caedbb2963dddac94a80097fde0798.zip |
LibCore: Add a wrapper for endgrent()
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibCore/System.cpp | 11 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/System.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index ce810cd925..13834394f4 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -687,6 +687,17 @@ ErrorOr<off_t> lseek(int fd, off_t offset, int whence) return rc; } +ErrorOr<void> endgrent() +{ + int old_errno = 0; + swap(old_errno, errno); + ::endgrent(); + if (errno != 0) + return Error::from_syscall("endgrent", -errno); + errno = old_errno; + return {}; +} + ErrorOr<WaitPidResult> waitpid(pid_t waitee, int options) { int wstatus; diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 75364d8b1d..1d73d28380 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -100,6 +100,7 @@ ErrorOr<void> clock_settime(clockid_t clock_id, struct timespec* ts); ErrorOr<pid_t> posix_spawn(StringView path, posix_spawn_file_actions_t const* file_actions, posix_spawnattr_t const* attr, char* const arguments[], char* const envp[]); ErrorOr<pid_t> posix_spawnp(StringView path, posix_spawn_file_actions_t* const file_actions, posix_spawnattr_t* const attr, char* const arguments[], char* const envp[]); ErrorOr<off_t> lseek(int fd, off_t, int whence); +ErrorOr<void> endgrent(); struct WaitPidResult { pid_t pid; |