commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 21/25: fshelp: Fix fetching the control port.


From: Samuel Thibault
Subject: [hurd] 21/25: fshelp: Fix fetching the control port.
Date: Mon, 24 Oct 2016 00:16:45 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 3319f7f6a238cf88b9f46849e7be84d3c96376d6
Author: Justus Winter <address@hidden>
Date:   Sun Oct 9 17:00:31 2016 +0200

    fshelp: Fix fetching the control port.
    
    * libfshelp/fetch-control.c (fshelp_fetch_control): Check if the
    control port is still alive, or deallocate the dead name, record the
    fact in the transbox, and return MACH_PORT_NULL.
---
 libfshelp/fetch-control.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libfshelp/fetch-control.c b/libfshelp/fetch-control.c
index 26c12d8..91c65bb 100644
--- a/libfshelp/fetch-control.c
+++ b/libfshelp/fetch-control.c
@@ -19,13 +19,24 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #include "fshelp.h"
+#include <assert.h>
 
 error_t
 fshelp_fetch_control (struct transbox *box,
                      mach_port_t *control)
 {
+  error_t err = 0;
   *control = box->active;
   if (*control != MACH_PORT_NULL)
-    mach_port_mod_refs (mach_task_self (), *control, MACH_PORT_RIGHT_SEND, 1);
-  return 0;
+    err = mach_port_mod_refs (mach_task_self (), *control,
+                              MACH_PORT_RIGHT_SEND, 1);
+
+  if (err == KERN_INVALID_RIGHT)
+    {
+      err = mach_port_deallocate (mach_task_self (), *control);
+      assert_perror (err);
+      *control = box->active = MACH_PORT_NULL;
+    }
+
+  return err;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]