mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix debug messages [ci skip]
This commit is contained in:
parent
f08fcd0e80
commit
b584c106d9
1 changed files with 5 additions and 2 deletions
7
random.c
7
random.c
|
@ -500,15 +500,18 @@ static int
|
||||||
fill_random_bytes_syscall(void *seed, size_t size, int unused)
|
fill_random_bytes_syscall(void *seed, size_t size, int unused)
|
||||||
{
|
{
|
||||||
#if USE_COMMON_RANDOM
|
#if USE_COMMON_RANDOM
|
||||||
int failed = CCRandomGenerateBytes(seed, size) != kCCSuccess;
|
CCRNGStatus status = CCRandomGenerateBytes(seed, size);
|
||||||
|
int failed = status != kCCSuccess;
|
||||||
#else
|
#else
|
||||||
int failed = SecRandomCopyBytes(kSecRandomDefault, size, seed) != errSecSuccess;
|
int status = SecRandomCopyBytes(kSecRandomDefault, size, seed);
|
||||||
|
int failed = status != errSecSuccess;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (failed) {
|
if (failed) {
|
||||||
# if 0
|
# if 0
|
||||||
# if USE_COMMON_RANDOM
|
# if USE_COMMON_RANDOM
|
||||||
/* How to get the error message? */
|
/* How to get the error message? */
|
||||||
|
fprintf(stderr, "CCRandomGenerateBytes failed: %d\n", status);
|
||||||
# else
|
# else
|
||||||
CFStringRef s = SecCopyErrorMessageString(status, NULL);
|
CFStringRef s = SecCopyErrorMessageString(status, NULL);
|
||||||
const char *m = s ? CFStringGetCStringPtr(s, kCFStringEncodingUTF8) : NULL;
|
const char *m = s ? CFStringGetCStringPtr(s, kCFStringEncodingUTF8) : NULL;
|
||||||
|
|
Loading…
Reference in a new issue