mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:44:58 +00:00
whoami: Port to LibMain :^)
This commit is contained in:
parent
a93205199b
commit
fbeebce4e3
2 changed files with 8 additions and 13 deletions
|
@ -123,4 +123,5 @@ target_link_libraries(cpp-parser LibCpp LibGUI)
|
|||
target_link_libraries(cpp-preprocessor LibCpp LibGUI)
|
||||
target_link_libraries(w LibMain)
|
||||
target_link_libraries(wasm LibWasm LibLine)
|
||||
target_link_libraries(whoami LibMain)
|
||||
target_link_libraries(wsctl LibGUI)
|
||||
|
|
|
@ -1,25 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int, char**)
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
if (pledge("stdio rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/etc/passwd", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
unveil(nullptr, nullptr);
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
TRY(Core::System::unveil("/etc/passwd", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
puts(getlogin());
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue