From b2399cd463b59e7228e0a93464e856ce6fae0a47 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 17 Sep 2012 13:41:33 +0000 Subject: [PATCH] -trying to fix bb errors --- src/util/crypto_rsa.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index 8843464a2..d94051201 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c @@ -943,6 +943,8 @@ check_key_generation_completion (void *cls, enum GNUNET_OS_ProcessStatusType type; unsigned long code; struct GNUNET_CRYPTO_RsaPrivateKey *pk; + char buf[512]; + ssize_t ret; gc->read_task = GNUNET_SCHEDULER_NO_TASK; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) @@ -955,9 +957,23 @@ check_key_generation_completion (void *cls, GNUNET_OS_process_status (gc->gnunet_rsa, &type, &code)) { - GNUNET_break (0); - gc->cont (gc->cont_cls, NULL, _("internal error")); - GNUNET_CRYPTO_rsa_key_create_stop (gc); + if (0 >= (ret = GNUNET_DISK_file_read (GNUNET_DISK_pipe_handle (gc->gnunet_rsa_out, + GNUNET_DISK_PIPE_END_READ), + buf, sizeof (buf)))) + { + GNUNET_break (0); + gc->cont (gc->cont_cls, NULL, _("internal error")); + GNUNET_CRYPTO_rsa_key_create_stop (gc); + return; + } + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + _("Unexpected gnunet-rsa output: %.*s\n"), + (int) ret, buf); + gc->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_DISK_pipe_handle (gc->gnunet_rsa_out, + GNUNET_DISK_PIPE_END_READ), + &check_key_generation_completion, + gc); return; } GNUNET_OS_process_destroy (gc->gnunet_rsa); @@ -977,6 +993,7 @@ check_key_generation_completion (void *cls, return; } gc->cont (gc->cont_cls, pk, NULL); + GNUNET_DISK_pipe_close (gc->gnunet_rsa_out); GNUNET_free (gc->filename); GNUNET_free (gc); } -- 2.25.1