mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
impl-core: avoid destroying the core object
Avoid destroying id 0 and return some errors. See #560
This commit is contained in:
parent
6a9552a4ac
commit
9862560f55
1 changed files with 3 additions and 1 deletions
|
|
@ -102,7 +102,7 @@ static int registry_destroy(void *object, uint32_t id)
|
|||
if (!PW_PERM_IS_R(permissions))
|
||||
goto error_no_id;
|
||||
|
||||
if (!PW_PERM_IS_X(permissions))
|
||||
if (id == PW_ID_CORE || !PW_PERM_IS_X(permissions))
|
||||
goto error_not_allowed;
|
||||
|
||||
pw_log_debug("global %p: destroy global id %d", global, id);
|
||||
|
|
@ -112,10 +112,12 @@ static int registry_destroy(void *object, uint32_t id)
|
|||
|
||||
error_no_id:
|
||||
pw_log_debug("registry %p: no global with id %u to destroy", resource, id);
|
||||
pw_resource_errorf(resource, -ENOENT, "no global %u", id);
|
||||
res = -ENOENT;
|
||||
goto error_exit;
|
||||
error_not_allowed:
|
||||
pw_log_debug("registry %p: destroy of id %u not allowed", resource, id);
|
||||
pw_resource_errorf(resource, -EPERM, "no permission to destroy %u", id);
|
||||
res = -EPERM;
|
||||
goto error_exit;
|
||||
error_exit:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue