diff options
author | Brian Gianforcaro <b.gianfo@gmail.com> | 2020-01-12 16:12:07 -0800 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-13 11:04:35 +0100 |
commit | a77da7f2458622ebd64cc088485b98d99ca92d79 (patch) | |
tree | 923c84e1acb19958bb005539dc1178b74cd56656 /Userland/ls.cpp | |
parent | 70defb34e6504e49dcc3eee17df4a0d1d2a7dd35 (diff) | |
download | serenity-a77da7f2458622ebd64cc088485b98d99ca92d79.zip |
ls: Use pledge()
Diffstat (limited to 'Userland/ls.cpp')
-rw-r--r-- | Userland/ls.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Userland/ls.cpp b/Userland/ls.cpp index 76cbaebd7a..0540301151 100644 --- a/Userland/ls.cpp +++ b/Userland/ls.cpp @@ -38,6 +38,11 @@ static HashMap<gid_t, String> groups; int main(int argc, char** argv) { + if (pledge("stdio rpath tty", nullptr) < 0) { + perror("pledge"); + return 1; + } + struct winsize ws; int rc = ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); if (rc == 0) { @@ -46,6 +51,11 @@ int main(int argc, char** argv) output_is_terminal = true; } + if (pledge("stdio rpath", nullptr) < 0) { + perror("pledge"); + return 1; + } + static const char* valid_option_characters = "ltraiGnh"; int opt; while ((opt = getopt(argc, argv, valid_option_characters)) != -1) { @@ -369,7 +379,7 @@ int do_file_system_object_short(const char* path) offset = terminal_columns % longest_name / (terminal_columns / longest_name); // The offset must be at least 2 because: - // - With each file an aditional char is printed e.g. '@','*'. + // - With each file an additional char is printed e.g. '@','*'. // - Each filename must be separated by a space. size_t column_width = longest_name + (offset > 0 ? offset : 2); printed_on_row += column_width; |