Bladeren bron

Actually, it's probably safer *not* to leave child processes hanging

around which still hold pointers to variables belonging to our parent...
tags/v0.9.3
Michael Brown 17 jaren geleden
bovenliggende
commit
d6909f65f0
1 gewijzigde bestanden met toevoegingen van 8 en 9 verwijderingen
  1. 8
    9
      src/core/resolv.c

+ 8
- 9
src/core/resolv.c Bestand weergeven

@@ -106,18 +106,16 @@ static void resolv_sigchld ( struct async *async,
106 106
 	/* Reap the child */
107 107
 	async_wait ( async, &rc, 1 );
108 108
 
109
-	/* If this child succeeded, kill all the others and return.
110
-	 * Killing the others means that this routine may be
111
-	 * re-entered; this is safe provided that no child returns a
112
-	 * success exit status when killed by SIGKILL.
109
+	/* If this child succeeded, kill all the others.  They should
110
+	 * immediately die (invoking resolv_sigchld() again, which
111
+	 * won't do anything because the exit status is non-zero and
112
+	 * the pending count won't reach zero until this instance
113
+	 * completes).
113 114
 	 */
114
-	if ( rc == 0 ) {
115
+	if ( rc == 0 )
115 116
 		async_signal_children ( async, SIGKILL );
116
-		async_done ( async, 0 );
117
-		return;
118
-	}
119 117
 
120
-	/* If we have no children left, return failure */
118
+	/* When we have no children left, exit */
121 119
 	if ( --(resolution->pending) == 0 )
122 120
 		async_done ( async, rc );
123 121
 }
@@ -135,6 +133,7 @@ static void resolv_reap ( struct async *async ) {
135 133
 static struct async_operations resolv_async_operations = {
136 134
 	.reap = resolv_reap,
137 135
 	.signal = {
136
+		[SIGKILL] = async_signal_children,
138 137
 		[SIGCHLD] = resolv_sigchld,
139 138
 	},
140 139
 };

Laden…
Annuleren
Opslaan