mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-02 19:29:31 +00:00
Merge pull request #2482 from signalwire/rand
[Core] Better handle error cases in switch_rand().
This commit is contained in:
commit
c80ab8b034
@ -4828,6 +4828,8 @@ SWITCH_DECLARE(int) switch_rand(void)
|
|||||||
if (!BCRYPT_SUCCESS(status)) {
|
if (!BCRYPT_SUCCESS(status)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "BCryptGenRandom failed with status %d\n", status);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "BCryptGenRandom failed with status %d\n", status);
|
||||||
|
|
||||||
|
BCryptCloseAlgorithmProvider(hAlgorithm, 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4856,6 +4858,8 @@ SWITCH_DECLARE(int) switch_rand(void)
|
|||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read failed: %s\n", error_msg);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read failed: %s\n", error_msg);
|
||||||
|
|
||||||
|
close(random_fd);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user