summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-18 10:47:23 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-18 11:35:47 +0100
commit1612a1d4898eb65a14130265265cabe566b4ecbf (patch)
tree904bee30fcd8b2bffd80d14a29b5293616995ec5
parentd6a1237cfe7585e2722f4861ef08fb72a3252cca (diff)
downloadserenity-1612a1d4898eb65a14130265265cabe566b4ecbf.zip
echo: Use pledge()
-rw-r--r--Userland/echo.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/echo.cpp b/Userland/echo.cpp
index 8a5c9f01d5..ba35732508 100644
--- a/Userland/echo.cpp
+++ b/Userland/echo.cpp
@@ -25,9 +25,15 @@
*/
#include <stdio.h>
+#include <unistd.h>
int main(int argc, char** argv)
{
+ if (pledge("stdio", nullptr) < 0) {
+ perror("pledge");
+ return 1;
+ }
+
for (int i = 1; i < argc; ++i) {
fputs(argv[i], stdout);
if (i != argc - 1)