summaryrefslogtreecommitdiff
path: root/libdiskfs/file-exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdiskfs/file-exec.c')
-rw-r--r--libdiskfs/file-exec.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libdiskfs/file-exec.c b/libdiskfs/file-exec.c
index 9a4ca35f..2fd60415 100644
--- a/libdiskfs/file-exec.c
+++ b/libdiskfs/file-exec.c
@@ -1,5 +1,5 @@
/* File execution (file_exec RPC) for diskfs servers, using exec server.
- Copyright (C) 1993,94,95,96,97,98,2000 Free Software Foundation, Inc.
+ Copyright (C) 1993,94,95,96,97,98,2000,02 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -53,6 +53,7 @@ diskfs_S_file_exec (struct protid *cred,
mode_t mode;
int suid, sgid;
struct protid *newpi;
+ struct peropen *newpo;
error_t err = 0;
mach_port_t execserver;
int cached_exec;
@@ -143,10 +144,15 @@ diskfs_S_file_exec (struct protid *cred,
server can read the executable file. We also include O_EXEC so that
the exec server can turn this peropen into a file descriptor in the
target process and permit it to exec its /dev/fd/N pseudo-file. */
- err = diskfs_create_protid (diskfs_make_peropen (np,
- O_READ|O_EXEC,
- cred->po),
- cred->user, &newpi);
+ {
+ err = diskfs_make_peropen (np, O_READ|O_EXEC, cred->po, &newpo);
+ if (! err)
+ {
+ err = diskfs_create_protid (newpo, cred->user, &newpi);
+ if (err)
+ diskfs_release_peropen (newpo);
+ }
+ }
if (! err)
{