return ENOENT for unknown resources

Fix some other errors as well, ENOSYS for invalid interface, ENOTSUP
for unimplemented methods.
This commit is contained in:
Wim Taymans 2020-11-20 12:11:37 +01:00
parent 12d831fc39
commit 387009e0d6
4 changed files with 6 additions and 6 deletions

View file

@ -204,19 +204,19 @@ process_messages(struct client_data *data)
resource = pw_impl_client_find_resource(client, msg->id);
if (resource == NULL) {
pw_resource_errorf(client->core_resource,
-EINVAL, "unknown resource %u op:%u", msg->id, msg->opcode);
-ENOENT, "unknown resource %u op:%u", msg->id, msg->opcode);
continue;
}
marshal = pw_resource_get_marshal(resource);
if (marshal == NULL || msg->opcode >= marshal->n_client_methods) {
res = -EINVAL;
res = -ENOSYS;
goto invalid_method;
}
demarshal = marshal->server_demarshal;
if (!demarshal[msg->opcode].func) {
res = -ENOENT;
res = -ENOTSUP;
goto invalid_message;
}

View file

@ -649,7 +649,7 @@ static int core_method_demarshal_destroy(void *object, const struct pw_protocol_
no_resource:
pw_log_debug("client %p: unknown resource %u op:%u", client, id, msg->opcode);
pw_resource_errorf(resource, -EINVAL, "unknown resource %d op:%u", id, msg->opcode);
pw_resource_errorf(resource, -ENOENT, "unknown resource %d op:%u", id, msg->opcode);
return 0;
}

View file

@ -747,7 +747,7 @@ static int core_demarshal_destroy(void *object, const struct pw_protocol_native_
no_resource:
pw_log_error("client %p: unknown resource %u op:%u", client, id, msg->opcode);
pw_resource_errorf(resource, -EINVAL, "unknown resource %d op:%u", id, msg->opcode);
pw_resource_errorf(resource, -ENOENT, "unknown resource %d op:%u", id, msg->opcode);
return 0;
}

View file

@ -74,7 +74,7 @@ error_no_id:
goto error_exit_clean;
error_wrong_interface:
pw_log_debug("registry %p: global with id %u has no interface %s", resource, id, type);
pw_resource_errorf_id(resource, new_id, -ENOENT, "no interface %s", type);
pw_resource_errorf_id(resource, new_id, -ENOSYS, "no interface %s", type);
goto error_exit_clean;
error_exit_clean:
/* unmark the new_id the map, the client does not yet know about the failed