From bbc0ba9e87f76111529d6dc9cb00c0b9435b5858 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Sun, 7 Aug 2011 12:18:20 +0400 Subject: [PATCH] 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 --- src/tincctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tincctl.c b/src/tincctl.c index b2e6e821..f0515c92 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; } -- 2.39.5