From b583f21e277b68c60f290379f97c7efbf55863a7 Mon Sep 17 00:00:00 2001 From: balatt <56897347+balatt@users.noreply.github.com> Date: Thu, 31 Oct 2019 00:06:55 -0400 Subject: [PATCH] Userland: cat no longer tries to open "cat" I made the mistake of starting the initial for loop at i=0 when it should have started at 1. argv[0] is the program name, argv[1] is an argument. --- Userland/cat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/cat.cpp b/Userland/cat.cpp index bfbcc110f10..b3500686025 100644 --- a/Userland/cat.cpp +++ b/Userland/cat.cpp @@ -11,7 +11,7 @@ int main(int argc, char** argv) { Vector fds; if (argc > 1) { - for (int i = 0; i < argc; i++) { + for (int i = 1; i < argc; i++) { int fd; if ((fd = open(argv[i], O_RDONLY)) == -1) { fprintf(stderr, "Failed to open %s: %s\n", argv[i], strerror(errno));