diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-07-03 20:29:15 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-07-03 20:29:15 +0200 |
commit | 64ed3488f3aff370a7173435d1d329f45801b032 (patch) | |
tree | 2d3f9c5844765a5deedaf9fa566d5dab4034b73e | |
parent | f6de6f3e97046f3c5dbac337e8ec905002de0557 (diff) | |
parent | c9f09bed813f3629809e28446db3268b552edfd1 (diff) | |
download | gnunet-64ed3488f3aff370a7173435d1d329f45801b032.tar.gz gnunet-64ed3488f3aff370a7173435d1d329f45801b032.zip |
Merge branch 'master' of git+ssh://git.gnunet.org/gnunet
-rw-r--r-- | src/util/child_management.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/util/child_management.c b/src/util/child_management.c index 680dbcabe..e78ebac9f 100644 --- a/src/util/child_management.c +++ b/src/util/child_management.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2021 GNUnet e.V. | 3 | Copyright (C) 2021-2023 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -153,6 +153,7 @@ sighandler_child_death (void) | |||
153 | errno = old_errno; /* restore errno */ | 153 | errno = old_errno; /* restore errno */ |
154 | } | 154 | } |
155 | 155 | ||
156 | |||
156 | /** | 157 | /** |
157 | * Initializing the signal pipe for child handling. | 158 | * Initializing the signal pipe for child handling. |
158 | */ | 159 | */ |
@@ -193,20 +194,13 @@ child_management_done (void) | |||
193 | } | 194 | } |
194 | 195 | ||
195 | 196 | ||
196 | /** | ||
197 | * Adding a child process to be monitored by the child management. | ||
198 | * | ||
199 | * @param proc The child process to be monitored. | ||
200 | * @param cb The callback to be called, when the child process completed. | ||
201 | * @param cb_cls The closure for the callback. | ||
202 | * @return An handle for the the child being monitored. | ||
203 | */ | ||
204 | struct GNUNET_ChildWaitHandle * | 197 | struct GNUNET_ChildWaitHandle * |
205 | GNUNET_wait_child (struct GNUNET_OS_Process *proc, | 198 | GNUNET_wait_child (struct GNUNET_OS_Process *proc, |
206 | GNUNET_ChildCompletedCallback cb, | 199 | GNUNET_ChildCompletedCallback cb, |
207 | void *cb_cls) | 200 | void *cb_cls) |
208 | { | 201 | { |
209 | struct GNUNET_ChildWaitHandle *cwh; | 202 | struct GNUNET_ChildWaitHandle *cwh; |
203 | bool may_race = (NULL == sigpipe); | ||
210 | 204 | ||
211 | child_management_start (); | 205 | child_management_start (); |
212 | cwh = GNUNET_new (struct GNUNET_ChildWaitHandle); | 206 | cwh = GNUNET_new (struct GNUNET_ChildWaitHandle); |
@@ -225,15 +219,14 @@ GNUNET_wait_child (struct GNUNET_OS_Process *proc, | |||
225 | &maint_child_death, | 219 | &maint_child_death, |
226 | NULL); | 220 | NULL); |
227 | } | 221 | } |
222 | /* Handle race-condition case where the child terminated just before we | ||
223 | installed the signal handler and thus we missed the signal. */ | ||
224 | if (may_race) | ||
225 | sighandler_child_death (); | ||
228 | return cwh; | 226 | return cwh; |
229 | } | 227 | } |
230 | 228 | ||
231 | 229 | ||
232 | /** | ||
233 | * Removing child handle. | ||
234 | * | ||
235 | * @param cwh The handle to be removed. | ||
236 | */ | ||
237 | void | 230 | void |
238 | GNUNET_wait_child_cancel (struct GNUNET_ChildWaitHandle *cwh) | 231 | GNUNET_wait_child_cancel (struct GNUNET_ChildWaitHandle *cwh) |
239 | { | 232 | { |