diff options
author | Andreas Kling <kling@serenityos.org> | 2020-11-08 14:52:33 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-08 16:16:03 +0100 |
commit | 6e592fb5c32b7de1d6b28badb572138d2d9e1197 (patch) | |
tree | a83ac2b03fc3a8886691150de91d65346fd3e437 | |
parent | 46cd9157cde8b455907d212b5924ba59ba8f922f (diff) | |
download | serenity-6e592fb5c32b7de1d6b28badb572138d2d9e1197.zip |
su: Refuse to run if stdin is not a TTY
-rw-r--r-- | Userland/su.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/su.cpp b/Userland/su.cpp index 71e1405d10..fae1bb526d 100644 --- a/Userland/su.cpp +++ b/Userland/su.cpp @@ -36,6 +36,11 @@ extern "C" int main(int, char**); int main(int argc, char** argv) { + if (!isatty(STDIN_FILENO)) { + warnln("{}: standard in is not a terminal", argv[0]); + return 1; + } + const char* user = nullptr; Core::ArgsParser args_parser; |