ladybird/Userland/Utilities/whoami.cpp

27 lines
440 B
C++
Raw Normal View History

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
2019-05-16 15:18:17 -03:00
#include <stdio.h>
#include <unistd.h>
int main(int, char**)
{
2020-02-18 07:01:31 -03:00
if (pledge("stdio rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
if (unveil("/etc/passwd", "r") < 0) {
perror("unveil");
return 1;
}
unveil(nullptr, nullptr);
2019-05-16 15:18:17 -03:00
puts(getlogin());
return 0;
}