aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_random.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-11-03 21:26:40 +0000
committerChristian Grothoff <christian@grothoff.org>2010-11-03 21:26:40 +0000
commit721e49caeea6ba5073f8bc5c6c08359295c02bb5 (patch)
treee06e80ba90af91e9452a48a7a5782913199b4877 /src/util/crypto_random.c
parent37ac1b7c9e9e05f93d4100cfb53450ec2d370989 (diff)
downloadgnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.tar.gz
gnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.zip
original patch from Mantis 1614
Diffstat (limited to 'src/util/crypto_random.c')
-rw-r--r--src/util/crypto_random.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index 4fcb157d9..75435a5e6 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -188,7 +188,7 @@ GNUNET_CRYPTO_random_disable_entropy_gathering ()
188 * Process ID of the "find" process that we use for 188 * Process ID of the "find" process that we use for
189 * entropy gathering. 189 * entropy gathering.
190 */ 190 */
191static pid_t genproc; 191static GNUNET_OS_Process *genproc;
192 192
193/** 193/**
194 * Function called by libgcrypt whenever we are 194 * Function called by libgcrypt whenever we are
@@ -206,16 +206,17 @@ entropy_generator (void *cls,
206 return; 206 return;
207 if (current == total) 207 if (current == total)
208 { 208 {
209 if (genproc != 0) 209 if (genproc != NULL)
210 { 210 {
211 if (0 != PLIBC_KILL (genproc, SIGTERM)) 211 if (0 != GNUNET_OS_process_kill (genproc, SIGTERM))
212 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill"); 212 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill");
213 GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); 213 GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc));
214 genproc = 0; 214 GNUNET_OS_process_close (genproc);
215 genproc = NULL;
215 } 216 }
216 return; 217 return;
217 } 218 }
218 if (genproc != 0) 219 if (genproc != NULL)
219 { 220 {
220 ret = GNUNET_OS_process_status (genproc, &type, &code); 221 ret = GNUNET_OS_process_status (genproc, &type, &code);
221 if (ret == GNUNET_NO) 222 if (ret == GNUNET_NO)
@@ -225,10 +226,11 @@ entropy_generator (void *cls,
225 GNUNET_break (0); 226 GNUNET_break (0);
226 return; 227 return;
227 } 228 }
228 if (0 != PLIBC_KILL (genproc, SIGTERM)) 229 if (0 != GNUNET_OS_process_kill (genproc, SIGTERM))
229 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill"); 230 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill");
230 GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); 231 GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc));
231 genproc = 0; 232 GNUNET_OS_process_close (genproc);
233 genproc = NULL;
232 } 234 }
233 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 235 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
234 _("Starting `%s' process to generate entropy\n"), "find"); 236 _("Starting `%s' process to generate entropy\n"), "find");
@@ -243,10 +245,11 @@ entropy_generator (void *cls,
243static void 245static void
244killfind () 246killfind ()
245{ 247{
246 if (genproc != 0) 248 if (genproc != NULL)
247 { 249 {
248 PLIBC_KILL (genproc, SIGKILL); 250 GNUNET_OS_process_kill (genproc, SIGKILL);
249 genproc = 0; 251 GNUNET_OS_process_close (genproc);
252 genproc = NULL;
250 } 253 }
251} 254}
252 255
@@ -279,3 +282,4 @@ void __attribute__ ((destructor)) GNUNET_CRYPTO_random_fini ()
279 282
280 283
281/* end of crypto_random.c */ 284/* end of crypto_random.c */
285