aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-02 08:47:33 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-02 08:47:33 +0000
commit9c4861364111fa25f4f7884b9f3b8cc0d52daa8e (patch)
tree152355433d1b45f4f6b71f5c42d259486cfd56e9 /src/transport/plugin_transport_http.c
parent50d29f1c62f82f9d1b7660413513ba61e4e9840e (diff)
downloadgnunet-9c4861364111fa25f4f7884b9f3b8cc0d52daa8e.tar.gz
gnunet-9c4861364111fa25f4f7884b9f3b8cc0d52daa8e.zip
fixing double waitpid
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r--src/transport/plugin_transport_http.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 528098f05..b0979fc88 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -3483,9 +3483,6 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3483 if ( (plugin->key==NULL) || (plugin->cert==NULL) ) 3483 if ( (plugin->key==NULL) || (plugin->cert==NULL) )
3484 { 3484 {
3485 struct GNUNET_OS_Process *certcreation; 3485 struct GNUNET_OS_Process *certcreation;
3486 enum GNUNET_OS_ProcessStatusType status_type = GNUNET_OS_PROCESS_UNKNOWN;
3487 unsigned long code = 0;
3488 int ret = 0;
3489 3486
3490 GNUNET_free_non_null (plugin->key); 3487 GNUNET_free_non_null (plugin->key);
3491 plugin->key = NULL; 3488 plugin->key = NULL;
@@ -3501,48 +3498,36 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3501 "gnunet-transport-certificate-creation", 3498 "gnunet-transport-certificate-creation",
3502 key_file, cert_file, 3499 key_file, cert_file,
3503 NULL); 3500 NULL);
3504 if ( (certcreation == NULL) || 3501 if (certcreation == NULL)
3505 (1 != (ret = 1) ) || (GNUNET_OS_process_wait (certcreation) != GNUNET_OK) ||
3506 (2 != (ret = 2) ) || (GNUNET_OS_process_status (certcreation, &status_type, &code) != GNUNET_OK) ||
3507 (3 != (ret = 3) ) || (status_type != GNUNET_OS_PROCESS_EXITED) ||
3508 (4 != (ret = 4) ) || (code != 0) )
3509 { 3502 {
3510 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 3503 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
3511 "https", 3504 "https",
3512 _("Could not create a new TLS certificate, program `gnunet-transport-certificate-creation' failed with errno %d, if-code %d, status %d, return value %d!\n"), 3505 _("Could not create a new TLS certificate, program `gnunet-transport-certificate-creation' could not be started!\n"));
3513 errno, ret, status_type, code);
3514 GNUNET_free (key_file); 3506 GNUNET_free (key_file);
3515 GNUNET_free (cert_file); 3507 GNUNET_free (cert_file);
3516 GNUNET_free (component_name); 3508 GNUNET_free (component_name);
3517 if (certcreation != NULL)
3518 {
3519 GNUNET_OS_process_kill (certcreation, SIGTERM);
3520 GNUNET_OS_process_close (certcreation);
3521 }
3522 LIBGNUNET_PLUGIN_TRANSPORT_DONE (api); 3509 LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
3523 return NULL; 3510 return NULL;
3524 } 3511 }
3512 GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (certcreation));
3525 GNUNET_OS_process_close (certcreation); 3513 GNUNET_OS_process_close (certcreation);
3526
3527 plugin->key = load_certificate (key_file); 3514 plugin->key = load_certificate (key_file);
3528 plugin->cert = load_certificate (cert_file); 3515 plugin->cert = load_certificate (cert_file);
3529 if ((plugin->key==NULL) || (plugin->cert==NULL))
3530 {
3531 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
3532 "https",
3533 _("No usable TLS certificate found and creating one failed!\n"),
3534 "transport-https");
3535 GNUNET_free (key_file);
3536 GNUNET_free (cert_file);
3537 GNUNET_free (component_name);
3538 LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
3539 return NULL;
3540 }
3541 } 3516 }
3517 if ( (plugin->key==NULL) || (plugin->cert==NULL) )
3518 {
3519 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
3520 "https",
3521 _("No usable TLS certificate found and creating one failed!\n"),
3522 "transport-https");
3523 GNUNET_free (key_file);
3524 GNUNET_free (cert_file);
3525 GNUNET_free (component_name);
3526 LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
3527 return NULL;
3528 }
3542 GNUNET_free (key_file); 3529 GNUNET_free (key_file);
3543 GNUNET_free (cert_file); 3530 GNUNET_free (cert_file);
3544
3545 GNUNET_assert((plugin->key!=NULL) && (plugin->cert!=NULL));
3546#if DEBUG_HTTP 3531#if DEBUG_HTTP
3547 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3532 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3548 "TLS certificate loaded\n"); 3533 "TLS certificate loaded\n");