diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-25 09:19:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-25 09:19:08 +0000 |
commit | bace3fe85e0dccc59a1d2352e028021e528608b5 (patch) | |
tree | de251c8689b94cd03f11829bd1a921e4d68e8b6a /src/transport/gnunet-transport-certificate-creation.c | |
parent | a1eb96a45362ce38357af8cc3106f23a888c6f2c (diff) | |
download | gnunet-bace3fe85e0dccc59a1d2352e028021e528608b5.tar.gz gnunet-bace3fe85e0dccc59a1d2352e028021e528608b5.zip |
-report error if starting openssl failed
Diffstat (limited to 'src/transport/gnunet-transport-certificate-creation.c')
-rw-r--r-- | src/transport/gnunet-transport-certificate-creation.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/transport/gnunet-transport-certificate-creation.c b/src/transport/gnunet-transport-certificate-creation.c index 5ecc7de42..b26d2e06d 100644 --- a/src/transport/gnunet-transport-certificate-creation.c +++ b/src/transport/gnunet-transport-certificate-creation.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2011, 2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -24,12 +24,12 @@ | |||
24 | * @author LRN | 24 | * @author LRN |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_disk_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_os_lib.h" | ||
29 | 28 | ||
30 | 29 | ||
31 | static void | 30 | static void |
32 | removecerts (const char *file1, const char *file2) | 31 | removecerts (const char *file1, |
32 | const char *file2) | ||
33 | { | 33 | { |
34 | if (GNUNET_YES == GNUNET_DISK_file_test (file1)) | 34 | if (GNUNET_YES == GNUNET_DISK_file_test (file1)) |
35 | { | 35 | { |
@@ -54,7 +54,11 @@ main (int argc, char **argv) | |||
54 | struct GNUNET_OS_Process *openssl; | 54 | struct GNUNET_OS_Process *openssl; |
55 | 55 | ||
56 | if (3 != argc) | 56 | if (3 != argc) |
57 | { | ||
58 | fprintf (stderr, | ||
59 | "Invalid arguments.\n"); | ||
57 | return 1; | 60 | return 1; |
61 | } | ||
58 | removecerts (argv[1], argv[2]); | 62 | removecerts (argv[1], argv[2]); |
59 | (void) close (2); /* eliminate stderr */ | 63 | (void) close (2); /* eliminate stderr */ |
60 | /* Create RSA Private Key */ | 64 | /* Create RSA Private Key */ |
@@ -63,7 +67,11 @@ main (int argc, char **argv) | |||
63 | GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "openssl", "openssl", "genrsa", | 67 | GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "openssl", "openssl", "genrsa", |
64 | "-out", argv[1], "1024", NULL); | 68 | "-out", argv[1], "1024", NULL); |
65 | if (NULL == openssl) | 69 | if (NULL == openssl) |
70 | { | ||
71 | fprintf (stderr, | ||
72 | "Failed to run openssl. Is openssl installed?\n"); | ||
66 | return 2; | 73 | return 2; |
74 | } | ||
67 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (openssl)); | 75 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (openssl)); |
68 | GNUNET_OS_process_destroy (openssl); | 76 | GNUNET_OS_process_destroy (openssl); |
69 | 77 | ||
@@ -74,7 +82,11 @@ main (int argc, char **argv) | |||
74 | "-batch", "-days", "365", "-out", argv[2], | 82 | "-batch", "-days", "365", "-out", argv[2], |
75 | "-new", "-x509", "-key", argv[1], NULL); | 83 | "-new", "-x509", "-key", argv[1], NULL); |
76 | if (NULL == openssl) | 84 | if (NULL == openssl) |
85 | { | ||
86 | fprintf (stderr, | ||
87 | "Failed to create self-signed certificate with openssl.\n"); | ||
77 | return 3; | 88 | return 3; |
89 | } | ||
78 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (openssl)); | 90 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (openssl)); |
79 | GNUNET_OS_process_destroy (openssl); | 91 | GNUNET_OS_process_destroy (openssl); |
80 | if (0 != CHMOD (argv[1], S_IRUSR)) | 92 | if (0 != CHMOD (argv[1], S_IRUSR)) |