mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-16 07:00:00 -05:00
Make getrandom() failure fatal
This commit is contained in:
parent
8b4fbac187
commit
906a1f5448
1 changed files with 10 additions and 8 deletions
|
|
@ -405,15 +405,17 @@ 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();
|
||||||
while (getrandom(&this->info.cookie, sizeof(this->info.cookie), 0) !=
|
do {
|
||||||
sizeof(this->info.cookie)) {
|
res = getrandom(&this->info.cookie,
|
||||||
if (errno == EINTR)
|
sizeof(this->info.cookie), 0);
|
||||||
continue;
|
} while ((res == -1) && (errno == EINTR));
|
||||||
pw_log_warn(NAME" %p: cookie getrandom failed: %m", this);
|
if (res == -1) {
|
||||||
this->info.cookie = rand();
|
res = -errno;
|
||||||
break;
|
goto error_exit;
|
||||||
|
} else if (res != sizeof(this->info.cookie)) {
|
||||||
|
res = -ENODATA;
|
||||||
|
goto error_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
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