mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-05 15:27:04 +00:00
whoami: Port to LibMain :^)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user