From a4406e4f8c9c84f429be507d797f4ff210bb74f0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 21 May 2013 12:57:28 +0000 Subject: [PATCH] -handle case that we are in restart on stop --- src/util/crypto_ecc.c | 3 ++- src/util/helper.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index 79c003b8e..b5a057aed 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c @@ -745,7 +745,8 @@ GNUNET_CRYPTO_ecc_key_create_stop (struct GNUNET_CRYPTO_EccKeyGenerationContext if (NULL != gc->filename) { - if (0 != UNLINK (gc->filename)) + if ( (0 != UNLINK (gc->filename)) && + (ENOENT != errno) ) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", gc->filename); GNUNET_free (gc->filename); } diff --git a/src/util/helper.c b/src/util/helper.c index c89f1ecb5..4187b819c 100644 --- a/src/util/helper.c +++ b/src/util/helper.c @@ -276,8 +276,16 @@ GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h) static void stop_helper (struct GNUNET_HELPER_Handle *h, int soft_kill) { - GNUNET_break (GNUNET_OK == GNUNET_HELPER_kill (h, soft_kill)); - GNUNET_break (GNUNET_OK == GNUNET_HELPER_wait (h)); + if (GNUNET_SCHEDULER_NO_TASK != h->restart_task) + { + GNUNET_SCHEDULER_cancel (h->restart_task); + h->restart_task = GNUNET_SCHEDULER_NO_TASK; + } + else + { + GNUNET_break (GNUNET_OK == GNUNET_HELPER_kill (h, soft_kill)); + GNUNET_break (GNUNET_OK == GNUNET_HELPER_wait (h)); + } } -- 2.25.1