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.
This commit is contained in:
balatt 2019-10-31 00:06:55 -04:00 committed by Andreas Kling
parent 7c71040ba9
commit b583f21e27
Notes: sideshowbarker 2024-07-19 11:29:46 +09:00

View File

@ -11,7 +11,7 @@ int main(int argc, char** argv)
{
Vector<int> 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));