mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-12 13:30:15 -05:00
impl-core: handle getrandom errors
Handle getrandom errors and fall back to rand() if all fails. See #583
This commit is contained in:
parent
f464d8c596
commit
8f5231bd45
1 changed files with 9 additions and 1 deletions
|
|
@ -405,7 +405,15 @@ struct pw_impl_core *pw_context_create_core(struct pw_context *context,
|
||||||
this->info.user_name = pw_get_user_name();
|
this->info.user_name = pw_get_user_name();
|
||||||
this->info.host_name = pw_get_host_name();
|
this->info.host_name = pw_get_host_name();
|
||||||
this->info.version = pw_get_library_version();
|
this->info.version = pw_get_library_version();
|
||||||
getrandom(&this->info.cookie, sizeof(this->info.cookie), 0);
|
while (getrandom(&this->info.cookie, sizeof(this->info.cookie), 0) !=
|
||||||
|
sizeof(this->info.cookie)) {
|
||||||
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
|
pw_log_warn(NAME" %p: cookie getrandom failed: %m", this);
|
||||||
|
this->info.cookie = rand();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
this->info.name = name;
|
this->info.name = name;
|
||||||
spa_hook_list_init(&this->listener_list);
|
spa_hook_list_init(&this->listener_list);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue