From b584c106d9f432431094136be67f11853bd3eb9c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 17 Oct 2022 15:33:28 +0900 Subject: [PATCH] Fix debug messages [ci skip] --- random.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/random.c b/random.c index 9476de0d4a..013e9f66e3 100644 --- a/random.c +++ b/random.c @@ -500,15 +500,18 @@ static int fill_random_bytes_syscall(void *seed, size_t size, int unused) { #if USE_COMMON_RANDOM - int failed = CCRandomGenerateBytes(seed, size) != kCCSuccess; + CCRNGStatus status = CCRandomGenerateBytes(seed, size); + int failed = status != kCCSuccess; #else - int failed = SecRandomCopyBytes(kSecRandomDefault, size, seed) != errSecSuccess; + int status = SecRandomCopyBytes(kSecRandomDefault, size, seed); + int failed = status != errSecSuccess; #endif if (failed) { # if 0 # if USE_COMMON_RANDOM /* How to get the error message? */ + fprintf(stderr, "CCRandomGenerateBytes failed: %d\n", status); # else CFStringRef s = SecCopyErrorMessageString(status, NULL); const char *m = s ? CFStringGetCStringPtr(s, kCFStringEncodingUTF8) : NULL;