summaryrefslogtreecommitdiff
path: root/exec/exec.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-01-30 21:13:36 +0000
committerMiles Bader <miles@gnu.org>1996-01-30 21:13:36 +0000
commite0123ef55045414c1954b1a2e1fd51a97e939b86 (patch)
tree60c42a2bb683a26e42f39f93b27add66bd593ed0 /exec/exec.c
parent18b42b98bdff600cd3e0cf0649983420a2d04607 (diff)
(S_exec_exec):
Use strdupa(). Update use of hurd_file_name_lookup() [still probably not right though].
Diffstat (limited to 'exec/exec.c')
-rw-r--r--exec/exec.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/exec/exec.c b/exec/exec.c
index 8004c650..0d123ce7 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -1643,21 +1643,33 @@ S_exec_exec (struct trivfs_protid *protid,
#if 0
if (!(flags & EXEC_SECURE))
{
- char *env_server_list = envz_get (envp, envplen, "EXECSERVERS");
+ char *list = envz_get (envp, envplen, "EXECSERVERS");
- if (env_server_list)
+ if (list)
{
int tried = 0;
- size_t len = strlen (p) + 1;
- char *list = alloca (len);
-
- memcpy (list, env_server_list, len);
+ list = strdupa (list);
while ((p = strsep (&list, ":")))
{
+ /* Open the named file using the appropriate directory ports for
+ the user. */
+ error_t user_port (int which, error_t (*operate) (mach_port_t))
+ {
+ return (*operate) (nports > which
+ ? portarray[which] : MACH_PORT_NULL);
+ }
+ file_t user_fd (int fd)
+ {
+ if (fd < 0 || fd >= dtablesize ||
+ dtable[fd] == MACH_PORT_NULL)
+ {
+ errno = EBADF;
+ return MACH_PORT_NULL;
+ }
+ return dtable[fd];
+ }
file_t server;
- if (!hurd_file_name_lookup (portarray[INIT_PORT_CRDIR],
- portarray[INIT_PORT_CWDIR],
- p, 0, 0, &server))
+ if (!hurd_file_name_lookup (user_port, user_fd, p, 0,0, &server))
{
error_t err;
struct trivfs_protid *protid