From 9862560f558192b9939b02e7908afd9aef136904 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 11 Jan 2021 13:18:11 +0100 Subject: [PATCH] impl-core: avoid destroying the core object Avoid destroying id 0 and return some errors. See #560 --- src/pipewire/impl-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pipewire/impl-core.c b/src/pipewire/impl-core.c index e65c4f12d..0c65e0a03 100644 --- a/src/pipewire/impl-core.c +++ b/src/pipewire/impl-core.c @@ -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: