Without this patch, when I use the command
tcpclient "$SJ_SERVER" 5223 tlsc ucspi-tee sj
I have to use a full path for ucspi-tee and sj. In other words, the
above command, as it is typed above, fails.
With this patch, it automatically searches my $PATH, so the above
command succeeds.
>From e85a6da16ed3270794784abd26f0ce4d6263f3cf Mon Sep 17 00:00:00 2001
From: Greg Reagle
Date: Tue, 8 Dec 2015 12:30:59 -0500
Subject: [PATCH] search path for executables
---
tlsc.c | 4 ++--
ucspi-tee.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tlsc.c b/tlsc.c
index be22e10..8be63cd 100644
--- a/tlsc.c
+++ b/tlsc.c
@@ -212,8 +212,8 @@ main(int argc, char *argv[], char *envp[])
if (close(pi[PIPE_WRITE]) < 0) err(EXIT_FAILURE, "close");
if (close(po_read) < 0) err(EXIT_FAILURE, "close");
- execve(prog, argv, environ);
- err(EXIT_FAILURE, "execve");
+ execvpe(prog, argv, environ);
+ err(EXIT_FAILURE, "execvpe");
default: break; /* parent */
}
diff --git a/ucspi-tee.c b/ucspi-tee.c
index 34905ee..62d4d28 100644
--- a/ucspi-tee.c
+++ b/ucspi-tee.c
@@ -112,8 +112,8 @@ main(int argc, char *argv[], char *envp[])
if (close(pi[PIPE_WRITE]) < 0) goto err;
if (close(po_read) < 0) goto err;
- execve(prog, argv, environ);
- err(EXIT_FAILURE, "execve()");
+ execvpe(prog, argv, environ);
+ err(EXIT_FAILURE, "execvpe()");
default: break;
}
--
1.9.1