As the title suggests, I'm getting a "Bad Address" error when calling execve(). Whenever I found someone else having the same problem, they were just omitting the NULLs at the end of the arrays, but I'm doing that here and I'm still getting the error. Anybody know what could be causing it?
switch(fork()) {
case 0: //child
(void) close(msock);
char *argv[] = {"./echo", (char *)ssock, NULL};
char *envp[] = {NULL};
int result = execve(argv[0], argv, envp);
if (result < 0) {
err_sys("execve");
}
case -1: //error
err_sys("fork");
break;
default: //parent
(void) close(ssock);
break;
}