aboutsummaryrefslogtreecommitdiff
path: root/src/util/gnunet-ecc.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-28 19:33:43 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-28 19:33:43 +0000
commit0b4edaacb7ed1b7581a5039d7c602b38bc9a027d (patch)
treef52a6046d63ab5773217e3decc9345ec9a1c9e9f /src/util/gnunet-ecc.c
parentda330bcf6e3b8b10843ed88611e6ff752d65bd99 (diff)
downloadgnunet-0b4edaacb7ed1b7581a5039d7c602b38bc9a027d.tar.gz
gnunet-0b4edaacb7ed1b7581a5039d7c602b38bc9a027d.zip
-adding missing close
Diffstat (limited to 'src/util/gnunet-ecc.c')
-rw-r--r--src/util/gnunet-ecc.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c
index 092dc7b38..d4e0f2387 100644
--- a/src/util/gnunet-ecc.c
+++ b/src/util/gnunet-ecc.c
@@ -113,7 +113,7 @@ create_keys (const char *fn)
113 113
114 114
115static void 115static void
116print_examples_ecdh (void) 116print_examples_ecdh ()
117{ 117{
118 struct GNUNET_CRYPTO_EcdhePrivateKey *dh_priv1; 118 struct GNUNET_CRYPTO_EcdhePrivateKey *dh_priv1;
119 struct GNUNET_CRYPTO_EcdhePublicKey *dh_pub1; 119 struct GNUNET_CRYPTO_EcdhePublicKey *dh_pub1;
@@ -156,7 +156,7 @@ print_examples_ecdh (void)
156 * Print some random example operations to stdout. 156 * Print some random example operations to stdout.
157 */ 157 */
158static void 158static void
159print_examples (void) 159print_examples ()
160{ 160{
161 print_examples_ecdh (); 161 print_examples_ecdh ();
162 // print_examples_ecdsa (); 162 // print_examples_ecdsa ();
@@ -178,7 +178,9 @@ print_key (const char *filename)
178 178
179 if (GNUNET_YES != GNUNET_DISK_file_test (filename)) 179 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
180 { 180 {
181 fprintf (stderr, _("Hostkeys file not found: %s\n"), filename); 181 fprintf (stderr,
182 _("Hostkeys file `%s' not found\n"),
183 filename);
182 return; 184 return;
183 } 185 }
184 186
@@ -187,13 +189,16 @@ print_key (const char *filename)
187 fs = 0; 189 fs = 0;
188 if (0 == fs) 190 if (0 == fs)
189 { 191 {
190 fprintf (stderr, _("Hostkeys file is empty: %s\n"), filename); 192 fprintf (stderr,
193 _("Hostkeys file `%s' is empty\n"),
194 filename);
191 return; /* File is empty */ 195 return; /* File is empty */
192 } 196 }
193 if (0 != (fs % GNUNET_TESTING_HOSTKEYFILESIZE)) 197 if (0 != (fs % GNUNET_TESTING_HOSTKEYFILESIZE))
194 { 198 {
195 fprintf (stderr, 199 fprintf (stderr,
196 _("Incorrect hostkey file format: %s\n"), filename); 200 _("Incorrect hostkey file format: %s\n"),
201 filename);
197 return; 202 return;
198 } 203 }
199 fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, 204 fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ,
@@ -204,11 +209,13 @@ print_key (const char *filename)
204 return; 209 return;
205 } 210 }
206 hostkeys_data = GNUNET_malloc (fs); 211 hostkeys_data = GNUNET_malloc (fs);
207 if (fs != GNUNET_DISK_file_read(fd, hostkeys_data, fs)) 212 if (fs != GNUNET_DISK_file_read (fd, hostkeys_data, fs))
208 { 213 {
209 fprintf (stderr, 214 fprintf (stderr,
210 _("Could not readk hostkey file: %s\n"), filename); 215 _("Could not read hostkey file: %s\n"),
216 filename);
211 GNUNET_free (hostkeys_data); 217 GNUNET_free (hostkeys_data);
218 GNUNET_DISK_file_close (fd);
212 return; 219 return;
213 } 220 }
214 GNUNET_DISK_file_close (fd); 221 GNUNET_DISK_file_close (fd);