7 ms·
I assume you looked up [0]. > [under int main (int argc, char *argv[]);] The argv and environ arrays are each terminated by a null pointer. The null pointer te
by planede 3y ago
I assume you looked up [0].
> [under int main (int argc, char *argv[]);] The argv and environ arrays are each terminated by a null pointer. The null pointer terminating the argv array is not counted in argc.
This confirms that the argv function parameter of main cannot be null.
I couldn't find the behavior specified for passing null for argv in exec*. As other comments pointed out some BSDs return with EINVAL. I think both this and Linux's behavior is compliant.
[0] https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html https://pubs.opengroup.org/onlinepubs/9699919799/functions/e...
- masfuerte 3y agoYou're right. I misread the list of errors as exhaustive.