title: execlp gives abort trap 6
body: <p>When i execute the following code and give the arguments as "ls - l" , i get the abort trap :6 and the program exits.But when i just give ls as input the program works fine.Why is that happening.</p>
  
  <p>Here :act_arg contains the string "ls" "-l"</p>
  
  <pre><code> void function_run()
      {
          char bar[100] = "/bin/";
          char f_arg[100];
          int baz;
          int qux = 1;
          strncat(bar,act_arg[0],sizeof(act_arg[0]));
          while(act_arg[qux] != NULL)
          {
              strncat(f_arg,act_arg[qux] ,sizeof(act_arg[qux]));
          }
  
          //execute
          if(fork() == 0)
          {
              baz = execlp(bar,act_arg[0],act_arg[1],NULL);
              if(baz == -1)
              {
                  eng_run();      //to run execlp from normal lang run
                  //wait(NULL);
              }
              else
              {
                  //wait(NULL);
                  exit(0);
              }
          }
          fflush(stdout);
      }
  </code></pre>