From: Michael Tokarev Date: Sun, 7 Aug 2011 08:18:20 +0000 (+0400) Subject: use execvp() not execve() in tincctl start X-Git-Tag: release-1.1pre3~165 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bbc0ba9e87f76111529d6dc9cb00c0b9435b5858;p=oweals%2Ftinc.git 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 --- diff --git a/src/tincctl.c b/src/tincctl.c index b2e6e82..f0515c9 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -516,7 +516,7 @@ static bool remove_service(void) { } #endif -int main(int argc, char *argv[], char *envp[]) { +int main(int argc, char *argv[]) { int fd; int result; char host[128]; @@ -586,7 +586,7 @@ int main(int argc, char *argv[], char *envp[]) { 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; }