[PATCH wayland] server: give more precise error message

Marek Chalupa mchqwerty at gmail.com
Thu Mar 19 00:42:27 PDT 2015


There are two same error messages with different cause.
Let user know what is the cause of the error.

Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
---
 src/wayland-server.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/wayland-server.c b/src/wayland-server.c
index ac4db65..7978430 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -245,7 +245,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
 	const struct wl_message *message;
 	uint32_t p[2];
 	uint32_t resource_flags;
-	int opcode, size;
+	int opcode, size, since;
 	int len;
 
 	if (mask & (WL_EVENT_ERROR | WL_EVENT_HANGUP)) {
@@ -301,13 +301,14 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
 		}
 
 		message = &object->interface->methods[opcode];
+		since = wl_message_get_since(message);
 		if (!(resource_flags & WL_MAP_ENTRY_LEGACY) &&
-		    resource->version > 0 &&
-		    resource->version < wl_message_get_since(message)) {
+		    resource->version > 0 && resource->version < since) {
 			wl_resource_post_error(client->display_resource,
 					       WL_DISPLAY_ERROR_INVALID_METHOD,
-					       "invalid method %d, object %s@%u",
-					       opcode,
+					       "invalid method %d (since %d < %d)"
+					       ", object %s@%u",
+					       opcode, resource->version, since,
 					       object->interface->name,
 					       object->id);
 			break;
-- 
2.1.0



More information about the wayland-devel mailing list