diff options
Diffstat (limited to 'tools/tool.c')
-rw-r--r-- | tools/tool.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/tool.c b/tools/tool.c index a2dbcbd..313484a 100644 --- a/tools/tool.c +++ b/tools/tool.c @@ -194,20 +194,19 @@ exec_external (const char *command, char *argv[]) { char *filename; - const char *path; - char *env; + char *path; if (!asprintf (&filename, "p11-kit-%s", command) < 0) return_if_reached (); /* Add our libexec directory to the path */ - path = getenv ("PATH"); - if (!asprintf (&env, "PATH=%s%s%s", path ? path : "", path ? P11_PATH_SEP : "", PRIVATEDIR)) - return_if_reached (); - putenv (env); + path = p11_path_build (PRIVATEDIR, filename, NULL); + return_if_fail (path != NULL); argv[0] = filename; - execvp (filename, argv); + argv[argc] = NULL; + + execvp (path, argv); } static void @@ -248,6 +247,8 @@ main (int argc, char *argv[]) if (!command) { skip = true; command = argv[in]; + } else { + skip = false; } /* The global long options */ |