execvp(arguments[0], arguments);
You need to do something if this call fails. If execvp
fails because you passed it a bad command, the child process will continue onward. That means the child will process the next command, rather than the parent. The parent will be stuck in its wait()
call, waiting for the child to terminate.
execvp(arguments[0], arguments);
perror("execvp");
_Exit(1);