sometimes argv[0] will have directory-less name (when the
command is started by shell searching in $PATH for example).
For tincctl start we want the same rules to run tincd as for
tincctl itself (having full path is better but if shell does
not provide one we've no other choice). Previous code tried
to run ./tincd in this case, which is obviously wrong.
This is a fix for the previous commit.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
}
#endif
-int main(int argc, char *argv[], char *envp[]) {
+int main(int argc, char *argv[]) {
int fd;
int result;
char host[128];
if (i != optind && strcmp(argv[i], "--") != 0)
argv[j++] = argv[i];
argv[j] = NULL;
- execve(c, argv, envp);
+ execvp(c, argv);
fprintf(stderr, "Could not start %s: %s\n", c, strerror(errno));
return 1;
}