diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 462aa65236..92ab111dcd 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -404,6 +404,8 @@ ErrorOr chown(StringView pathname, uid_t uid, gid_t gid) ErrorOr> getpwnam(StringView name) { + errno = 0; + ::setpwent(); if (errno) return Error::from_syscall("getpwnam"sv, -errno); @@ -422,6 +424,8 @@ ErrorOr> getpwnam(StringView name) ErrorOr> getgrnam(StringView name) { + errno = 0; + ::setgrent(); if (errno) return Error::from_syscall("getgrnam"sv, -errno);