execvp(argv[1], &argv[1])
What exactly is done with the second argument of execvp()?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The second argument should be a pointer to a
NULL-terminated array of strings, which becomes theargvof the called process.The first element of this array becomes the
argv[0]of the callee, which is not necessarily the same as its path; e.g., you can call a process by its full path, but pass it its basename asargv[0]. Also, some programs behave differently based on theirargv[0]. The famous example is that Unix shells behave as “login shells” when theirargv[0]starts with a-, so a primitiveloginprogram could do