crypto_random.c | crypto_random.c | |||
---|---|---|---|---|
skipping to change at line 257 | skipping to change at line 257 | |||
if (0 != strcmp (what, "need_entropy")) | if (0 != strcmp (what, "need_entropy")) | |||
return; | return; | |||
if (current == total) | if (current == total) | |||
{ | { | |||
if (genproc != NULL) | if (genproc != NULL) | |||
{ | { | |||
if (0 != GNUNET_OS_process_kill (genproc, SIGTERM)) | if (0 != GNUNET_OS_process_kill (genproc, SIGTERM)) | |||
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "kill"); | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "kill"); | |||
GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); | GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); | |||
GNUNET_OS_process_close (genproc); | GNUNET_OS_process_destroy (genproc); | |||
genproc = NULL; | genproc = NULL; | |||
} | } | |||
return; | return; | |||
} | } | |||
if (genproc != NULL) | if (genproc != NULL) | |||
{ | { | |||
ret = GNUNET_OS_process_status (genproc, &type, &code); | ret = GNUNET_OS_process_status (genproc, &type, &code); | |||
if (ret == GNUNET_NO) | if (ret == GNUNET_NO) | |||
return; /* still running */ | return; /* still running */ | |||
if (ret == GNUNET_SYSERR) | if (ret == GNUNET_SYSERR) | |||
{ | { | |||
GNUNET_break (0); | GNUNET_break (0); | |||
return; | return; | |||
} | } | |||
if (0 != GNUNET_OS_process_kill (genproc, SIGTERM)) | if (0 != GNUNET_OS_process_kill (genproc, SIGTERM)) | |||
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "kill"); | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "kill"); | |||
GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); | GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc)); | |||
GNUNET_OS_process_close (genproc); | GNUNET_OS_process_destroy (genproc); | |||
genproc = NULL; | genproc = NULL; | |||
} | } | |||
LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy \n"), | LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy \n"), | |||
"find"); | "find"); | |||
genproc = | genproc = | |||
GNUNET_OS_start_process (GNUNET_NO, | GNUNET_OS_start_process (GNUNET_NO, | |||
NULL, NULL, "sh", "sh", "-c", | NULL, NULL, "sh", "sh", "-c", | |||
"exec find / -mount -type f -exec cp {} /dev/n ull \\; 2>/dev/null", | "exec find / -mount -type f -exec cp {} /dev/n ull \\; 2>/dev/null", | |||
NULL); | NULL); | |||
} | } | |||
static void | static void | |||
killfind () | killfind () | |||
{ | { | |||
if (genproc != NULL) | if (genproc != NULL) | |||
{ | { | |||
GNUNET_OS_process_kill (genproc, SIGKILL); | GNUNET_OS_process_kill (genproc, SIGKILL); | |||
GNUNET_OS_process_close (genproc); | GNUNET_OS_process_destroy (genproc); | |||
genproc = NULL; | genproc = NULL; | |||
} | } | |||
} | } | |||
void __attribute__ ((constructor)) GNUNET_CRYPTO_random_init () | void __attribute__ ((constructor)) GNUNET_CRYPTO_random_init () | |||
{ | { | |||
gcry_control (GCRYCTL_DISABLE_SECMEM, 0); | gcry_control (GCRYCTL_DISABLE_SECMEM, 0); | |||
if (!gcry_check_version (GCRYPT_VERSION)) | if (!gcry_check_version (GCRYPT_VERSION)) | |||
{ | { | |||
FPRINTF (stderr, | FPRINTF (stderr, | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |