From 8c3107c9898a13038e8674f29178e35797133462 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 13 May 2002 21:39:38 +0000 Subject: 2002-05-13 Roland McGrath * fakeroot.c (netfs_S_file_exec): Don't lock the node (no need). Don't use MACH_MSG_TYPE_MOVE_SEND. --- trans/fakeroot.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'trans/fakeroot.c') 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; } -- cgit v1.2.3