summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/System.cpp
diff options
context:
space:
mode:
authorLucas CHOLLET <lucas.chollet@free.fr>2022-06-08 14:39:59 +0200
committerAndreas Kling <kling@serenityos.org>2022-06-09 22:08:04 +0200
commitd288c700c7caedbb2963dddac94a80097fde0798 (patch)
tree36ff589f2c047169ed162c47223a5e4b26834c65 /Userland/Libraries/LibCore/System.cpp
parent348750a9f4fd597276f2160decfe704ead08939e (diff)
downloadserenity-d288c700c7caedbb2963dddac94a80097fde0798.zip
LibCore: Add a wrapper for endgrent()
Diffstat (limited to 'Userland/Libraries/LibCore/System.cpp')
-rw-r--r--Userland/Libraries/LibCore/System.cpp11
1 files changed, 11 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;