diff --git a/userspace/whoami/main.cpp b/userspace/whoami/main.cpp index a042c569c7..514c0e78ae 100644 --- a/userspace/whoami/main.cpp +++ b/userspace/whoami/main.cpp @@ -1,16 +1,14 @@ -#include #include #include int main() { - auto* pw = getpwuid(geteuid()); - if (pw == nullptr) + char* login = getlogin(); + if (login == nullptr) { printf("unknown user %d\n", geteuid()); return 1; } - printf("%s\n", pw->pw_name); - endpwent(); + printf("%s\n", login); return 0; }