summaryrefslogtreecommitdiff
path: root/trans/fakeroot.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-05-13 21:39:38 +0000
committerRoland McGrath <roland@gnu.org>2002-05-13 21:39:38 +0000
commit8c3107c9898a13038e8674f29178e35797133462 (patch)
treee6219d1c654f2c6d892125150b678c43dcbf66f8 /trans/fakeroot.c
parentb866c800c9f57a22007e7ed80d3109e67d332a2a (diff)
2002-05-13 Roland McGrath <roland@frob.com>
* fakeroot.c (netfs_S_file_exec): Don't lock the node (no need). Don't use MACH_MSG_TYPE_MOVE_SEND.
Diffstat (limited to 'trans/fakeroot.c')
-rw-r--r--trans/fakeroot.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index f1bd024e..15b617ee 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -600,13 +600,22 @@ netfs_S_file_exec (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ /* We cannot use MACH_MSG_TYPE_MOVE_SEND because we might need to
+ retry an interrupted call that would have consumed the rights. */
err = file_exec (user->po->np->nn->file, task, flags, argv, argvlen,
- envp, envplen, fds, MACH_MSG_TYPE_MOVE_SEND, fdslen,
- portarray, MACH_MSG_TYPE_MOVE_SEND, portarraylen,
+ envp, envplen, fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
+ portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
intarray, intarraylen, deallocnames, deallocnameslen,
destroynames, destroynameslen);
- mutex_unlock (&user->po->np->lock);
+ if (err == 0)
+ {
+ size_t i;
+ mach_port_deallocate (mach_task_self (), task);
+ for (i = 0; i < fdslen; ++i)
+ mach_port_deallocate (mach_task_self (), fds[i]);
+ for (i = 0; i < portarraylen; ++i)
+ mach_port_deallocate (mach_task_self (), portarray[i]);
+ }
return err;
}