summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/execvp.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-05-14 14:19:32 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-05-14 14:19:32 +0000
commit167217bec15c9c7aa70ba2a3dc9c689b3cd91872 (patch)
tree7c0c62debf8f9f145643102fb52b81afce743594 /mdk-stage1/dietlibc/lib/execvp.c
parent9097327dc1c667fc51b8e05cc7c0626fac96665d (diff)
downloaddrakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.gz
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.bz2
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.xz
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.zip
import new version of dietlibc
Diffstat (limited to 'mdk-stage1/dietlibc/lib/execvp.c')
-rw-r--r--mdk-stage1/dietlibc/lib/execvp.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/mdk-stage1/dietlibc/lib/execvp.c b/mdk-stage1/dietlibc/lib/execvp.c
index 809252990..20521d69f 100644
--- a/mdk-stage1/dietlibc/lib/execvp.c
+++ b/mdk-stage1/dietlibc/lib/execvp.c
@@ -2,25 +2,8 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <paths.h>
#include <errno.h>
-
-extern char **environ;
-
-static int exec_shell(const char *file, char *const argv[]) {
- int i;
-
- for (i = 0; argv[i]; i++);
-
- if (1) {
- char *shell_argv[i + 1];
- shell_argv[0] = _PATH_BSHELL;
- shell_argv[1] = (char *) file;
- for (; i > 1; i--)
- shell_argv[i] = argv[i - 1];
- return execve(_PATH_BSHELL, shell_argv, environ);
- }
-}
+#include "exec_lib.h"
int execvp(const char *file, char *const argv[]) {
char *path=getenv("PATH");
@@ -28,7 +11,7 @@ int execvp(const char *file, char *const argv[]) {
char buf[PATH_MAX];
if (strchr((char*)file,'/')) {
if (execve(file,argv,environ)==-1) {
- if (errno==ENOEXEC) exec_shell(file,argv);
+ if (errno==ENOEXEC) __exec_shell(file,argv);
return -1;
}
}
@@ -45,7 +28,7 @@ int execvp(const char *file, char *const argv[]) {
buf[next-cur]='/';
memmove(&buf[next-cur+1],file,strlen(file)+1);
if (execve(buf,argv,environ)==-1) {
- if (errno==ENOEXEC) return exec_shell(buf,argv);
+ if (errno==ENOEXEC) return __exec_shell(buf,argv);
if ((errno!=EACCES) && (errno!=ENOENT)) return -1;
}
if (*next==0) break;