Index: b/usr/src/lib/libc/port/gen/execvp.c =================================================================== --- a/usr/src/lib/libc/port/gen/execvp.c +++ b/usr/src/lib/libc/port/gen/execvp.c @@ -104,7 +104,7 @@ execlp(const char *name, const char *arg } int -execvp(const char *name, char *const *argv) +execvpe(const char *name, char *const *argv, char *const *envp) { const char *pathstr; char fname[PATH_MAX+2]; @@ -164,7 +164,10 @@ execvp(const char *name, char *const *ar fname[0] = '.'; fname[1] = '/'; } - (void) execv(fname, argv); + if (1 == (uintptr_t)envp) + (void) execv(fname, argv); + else + (void) execve(fname, argv, envp); switch (errno) { case ENOEXEC: newargs[0] = "sh"; @@ -175,7 +178,10 @@ execvp(const char *name, char *const *ar return (-1); } } - (void) execv(_PATH_BSHELL, newargs); + if (1 == (uintptr_t)envp) + (void) execve(_PATH_BSHELL, newargs, envp); + else + (void) execv(_PATH_BSHELL, newargs); return (-1); case ETXTBSY: if (++etxtbsy > 5) @@ -196,6 +202,13 @@ execvp(const char *name, char *const *ar return (-1); } +int +execvp(const char *name, char *const *argv) +{ + /* 1 is an invalid pointer and means: run ins current environment. */ + return execvpe(name, argv, (char * const *)(uintptr_t)1); +} + static const char * execat(const char *s1, const char *s2, char *si) { Index: b/usr/src/lib/libc/port/mapfile-vers =================================================================== --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -269,6 +269,7 @@ SYMBOL_VERSION DYSON_1 { error_message_count; error_one_per_line; error_print_progname; + execvpe; flock; fts_children; fts_close; Index: b/usr/src/head/unistd.h =================================================================== --- a/usr/src/head/unistd.h +++ b/usr/src/head/unistd.h @@ -290,6 +290,9 @@ extern int execlp(const char *, const ch extern int execv(const char *, char *const *); extern int execve(const char *, char *const *, char *const *); extern int execvp(const char *, char *const *); +#if defined(_GNU_SOURCE) || defined(__EXTENSIONS__) +extern int execvpe(const char *, char *const *, char *const *); +#endif extern void _exit(int) __NORETURN; /*