summaryrefslogtreecommitdiff
path: root/debian/patches/libdiskfs_self-reauth.patch
blob: b3e048b2536b40ee45a0879c3ee966a42076429a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"RPC to self with rendez-vous leading to duplicate port destroy"

http://lists.gnu.org/archive/html/bug-hurd/2011-03/msg00045.html

diff --git a/libfshelp/fetch-root.c b/libfshelp/fetch-root.c
index 54d3c0c..6585052 100644
--- a/libfshelp/fetch-root.c
+++ b/libfshelp/fetch-root.c
@@ -79,7 +79,9 @@ fshelp_fetch_root (struct transbox *box, void *cookie,
 	  if (err)
 	    ret = MACH_PORT_NULL;
 
-	  mach_port_destroy (mach_task_self (), rend);
+	  /* crdir could be ourselves, and thus diskfs_S_io_reauthenticate
+	   * would get the same name, so don't _destroy_ it !! */
+	  mach_port_mod_refs (mach_task_self (), rend, MACH_PORT_RIGHT_RECEIVE, -1);
 
 	  return ret;
 	}
diff --git a/libshouldbeinlibc/exec-reauth.c b/libshouldbeinlibc/exec-reauth.c
index dd267ef..12b34fc 100644
--- a/libshouldbeinlibc/exec-reauth.c
+++ b/libshouldbeinlibc/exec-reauth.c
@@ -59,7 +59,7 @@ exec_reauth (auth_t auth, int secure, int must_reauth,
 	  if (!err)
 	    err = auth_user_authenticate (auth, ref, MACH_MSG_TYPE_MAKE_SEND,
 					  &newport);
-	  mach_port_destroy (mach_task_self (), ref);
+	  mach_port_mod_refs (mach_task_self (), ref, MACH_PORT_RIGHT_RECEIVE, -1);
 	  if (err)
 	    {
 	      if (must_reauth)