File: libports-iterate-refcount.patch

package info (click to toggle)
hurd 1%3A0.9.git20250801-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 37,352 kB
  • sloc: ansic: 538,803; sh: 5,143; asm: 2,998; makefile: 2,303; perl: 589; pascal: 484; awk: 157
file content (22 lines) | stat: -rw-r--r-- 671 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
http://lists.gnu.org/archive/html/bug-hurd/2016-03/msg00034.html

diff --git a/libports/bucket-iterate.c b/libports/bucket-iterate.c
index b021b99..76dc3f7 100644
--- a/libports/bucket-iterate.c
+++ b/libports/bucket-iterate.c
@@ -58,7 +58,14 @@ _ports_bucket_class_iterate (struct hurd_ihash *ht,
 
       if (class == 0 || pi->class == class)
 	{
-	  refcounts_ref (&pi->refcounts, NULL);
+	  struct references result;
+	  refcounts_unsafe_ref (&pi->refcounts, &result);
+	  if (result.hard == 1 && result.weak == 0)
+	  {
+	    /* This one is on its way out, skip it.  */
+	    refcounts_deref (&pi->refcounts, NULL);
+	    continue;
+	  }
 	  p[n] = pi;
 	  n++;
 	}