title: Using fork and execvp in c causing error
body: <p>I am attempting to use fork/execvp to execute another program from within my C program. It is working, however before ls outputs the contents of my directory I am getting several hundred lines of:</p>
  
  <pre><code>ls: cannot access : No such file or directory
  </code></pre>
  
  <p>Followed by the correct listing of the files in the directory. I am passing to execvp:</p>
  
  <pre><code>char **argv = {"ls", "/home/school/"};
  char *command = "ls";
  </code></pre>
  
  <p>For some reason when I use the path "/home/school" it cannot find the directory. Does anyone know why that is happening and why ls is saying it cannot access?</p>
  
  <pre><code>PID  = fork();
  i = 0;
  if(i == numArgs) { doneFlag = 1; }
      if (PID == 0){//child process
          execvp(command, argv);//needs error checking
      }
      else if(PID &gt; 0){
          wait(PID, 0, 0);//wait for child process to finish execution
      }
      else if(PID == -1){
          printf("ERROR:\n");
          switch (errno){
              case EAGAIN:
           printf("Cannot fork process: System Process Limit Reached\n");
           case ENOMEM:
           printf("Cannot fork process: Out of memory\n");
          }
          return 1;
      }
  </code></pre>