Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2002-10-15 20:55:46 -0400
committerAlain Magloire2002-10-15 20:55:46 -0400
commitdbb6aec9995effd9c117bb49157f6c9c8c9d5624 (patch)
treeba3615eb00f4b4f9b545c0efe29c6b7b941e0fa8 /core/org.eclipse.cdt.core.linux/library
parenta509b0baaa93383d96325665dee2a7fd80ca1577 (diff)
downloadorg.eclipse.cdt-dbb6aec9995effd9c117bb49157f6c9c8c9d5624.tar.gz
org.eclipse.cdt-dbb6aec9995effd9c117bb49157f6c9c8c9d5624.tar.xz
org.eclipse.cdt-dbb6aec9995effd9c117bb49157f6c9c8c9d5624.zip
Always call pfind() to check the path
Diffstat (limited to 'core/org.eclipse.cdt.core.linux/library')
-rw-r--r--core/org.eclipse.cdt.core.linux/library/exec_unix.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/core/org.eclipse.cdt.core.linux/library/exec_unix.c b/core/org.eclipse.cdt.core.linux/library/exec_unix.c
index 3418866b9ae..14bb203b93a 100644
--- a/core/org.eclipse.cdt.core.linux/library/exec_unix.c
+++ b/core/org.eclipse.cdt.core.linux/library/exec_unix.c
@@ -8,7 +8,7 @@
#include <stdlib.h>
/* from pfind.c */
-char *pfind( char *name );
+extern char *pfind(const char *name);
pid_t
exec0(const char *path, char *const argv[], char *const envp[],
@@ -19,17 +19,13 @@ exec0(const char *path, char *const argv[], char *const envp[],
char *full_path;
/*
- * Handle this error case, we need the full path for execve() below.
+ * We use pfind() to check that the program exists and is an executable.
+ * If not pass the error up. Also execve() wants a full path.
*/
- if (path[0] != '/' && path[0] != '.') {
- full_path = pfind(path);
- //full_path = pathfind (getenv ("PATH"), path, "rx");
- if (full_path == NULL) {
- fprintf(stderr, "Unable to find full path for \"%s\"\n", path );
- return -1;
- }
- } else {
- full_path = strdup(path);
+ full_path = pfind(path);
+ if (full_path == NULL) {
+ fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
+ return -1;
}
/*

Back to the top