use execvp() not execve() in tincctl start

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>
This commit is contained in:
Michael Tokarev 2011-08-07 12:18:20 +04:00 committed by Guus Sliepen
parent a7556a9d2c
commit bbc0ba9e87

View file

@ -516,7 +516,7 @@ static bool remove_service(void) {
} }
#endif #endif
int main(int argc, char *argv[], char *envp[]) { int main(int argc, char *argv[]) {
int fd; int fd;
int result; int result;
char host[128]; char host[128];
@ -586,7 +586,7 @@ int main(int argc, char *argv[], char *envp[]) {
if (i != optind && strcmp(argv[i], "--") != 0) if (i != optind && strcmp(argv[i], "--") != 0)
argv[j++] = argv[i]; argv[j++] = argv[i];
argv[j] = NULL; argv[j] = NULL;
execve(c, argv, envp); execvp(c, argv);
fprintf(stderr, "Could not start %s: %s\n", c, strerror(errno)); fprintf(stderr, "Could not start %s: %s\n", c, strerror(errno));
return 1; return 1;
} }