summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-25 16:01:28 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-25 16:01:28 +0200
commitdf8e76a67ce6fdd469dc2782819f3c9081a0f8ac (patch)
tree90bc2eda13c9f07852f18f455c29dbd0b3310b52 /Userland
parent6c950f8f830b7314f7df3ac08d391bcd226c19a7 (diff)
downloadserenity-df8e76a67ce6fdd469dc2782819f3c9081a0f8ac.zip
cat: Just use fd 0 when no arguments are passed.
I'm not sure why it seemed necessary at some point to open /dev/stdin rather than simply using the already-open fd 0.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/cat.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Userland/cat.cpp b/Userland/cat.cpp
index 5454d7e982..d084b532ed 100644
--- a/Userland/cat.cpp
+++ b/Userland/cat.cpp
@@ -8,10 +8,9 @@
int main(int argc, char** argv)
{
- const char* input_file = argc > 1 ? argv[1] : "/dev/stdin";
- int fd = open(input_file, O_RDONLY);
+ int fd = argc > 1 ? open(argv[1], O_RDONLY) : 0;
if (fd == -1) {
- printf("failed to open %s: %s\n", input_file, strerror(errno));
+ printf("failed to open %s: %s\n", argv[1], strerror(errno));
return 1;
}
for (;;) {