diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-22 17:29:03 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-22 17:29:03 +0000 |
commit | b9d47fab2e69e34326ec67bcf1144db45aef5b58 (patch) | |
tree | 7d7427946011cba0f71bf50194bb1578403f698f /src/testbed | |
parent | d1bebde16276dfde094f9ff6c010ee1a84379940 (diff) | |
download | gnunet-b9d47fab2e69e34326ec67bcf1144db45aef5b58.tar.gz gnunet-b9d47fab2e69e34326ec67bcf1144db45aef5b58.zip |
fix: 2839
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/gnunet-helper-testbed.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c index 6df42c609..4c78e3252 100644 --- a/src/testbed/gnunet-helper-testbed.c +++ b/src/testbed/gnunet-helper-testbed.c | |||
@@ -267,6 +267,9 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
267 | { | 267 | { |
268 | const struct GNUNET_DISK_FileHandle *pr; | 268 | const struct GNUNET_DISK_FileHandle *pr; |
269 | char c[16]; | 269 | char c[16]; |
270 | enum GNUNET_OS_ProcessStatusType type; | ||
271 | unsigned long code; | ||
272 | int ret; | ||
270 | 273 | ||
271 | pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); | 274 | pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); |
272 | child_death_task_id = GNUNET_SCHEDULER_NO_TASK; | 275 | child_death_task_id = GNUNET_SCHEDULER_NO_TASK; |
@@ -279,14 +282,25 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
279 | } | 282 | } |
280 | /* consume the signal */ | 283 | /* consume the signal */ |
281 | GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c))); | 284 | GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c))); |
282 | LOG_DEBUG ("Child died\n"); | 285 | LOG_DEBUG ("Got SIGCHLD\n"); |
283 | if (NULL != testbed) | 286 | if (NULL == testbed) |
287 | { | ||
288 | GNUNET_break (0); | ||
289 | return; | ||
290 | } | ||
291 | GNUNET_break (GNUNET_SYSERR != | ||
292 | (ret = GNUNET_OS_process_status (testbed, &type, &code))); | ||
293 | if (GNUNET_NO != ret) | ||
284 | { | 294 | { |
285 | GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (testbed)); | ||
286 | GNUNET_OS_process_destroy (testbed); | 295 | GNUNET_OS_process_destroy (testbed); |
287 | testbed = NULL; | 296 | testbed = NULL; |
297 | shutdown_now (); | ||
298 | return; | ||
288 | } | 299 | } |
289 | shutdown_now (); | 300 | LOG_DEBUG ("Child hasn't died. Resuming to monitor its status\n"); |
301 | child_death_task_id = | ||
302 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
303 | pr, &child_death_task, NULL); | ||
290 | } | 304 | } |
291 | 305 | ||
292 | 306 | ||