diff options
| -rw-r--r-- | src/connection.c | 10 | ||||
| -rw-r--r-- | src/wayland-util.c | 14 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/connection.c b/src/connection.c index a2d1b2f..3a4ab47 100644 --- a/src/connection.c +++ b/src/connection.c @@ -810,10 +810,12 @@ wl_connection_demarshal(struct wl_connection *connection, } if (wl_map_reserve_new(objects, id) < 0) { - wl_log("not a valid new object id (%u), " - "message %s(%s)\n", - id, message->name, message->signature); - errno = EINVAL; + if (errno == EINVAL) { + wl_log("not a valid new object id (%u), " + "message %s(%s)\n", id, + message->name, + message->signature); + } goto err; } diff --git a/src/wayland-util.c b/src/wayland-util.c index 68116bf..ee74bc1 100644 --- a/src/wayland-util.c +++ b/src/wayland-util.c @@ -24,6 +24,7 @@ * SOFTWARE. */ +#include <errno.h> #include <stdlib.h> #include <stdint.h> #include <stdio.h> @@ -261,13 +262,17 @@ wl_map_reserve_new(struct wl_map *map, uint32_t i) struct wl_array *entries; if (i < WL_SERVER_ID_START) { - if (map->side == WL_MAP_CLIENT_SIDE) + if (map->side == WL_MAP_CLIENT_SIDE) { + errno = EINVAL; return -1; + } entries = &map->client_entries; } else { - if (map->side == WL_MAP_SERVER_SIDE) + if (map->side == WL_MAP_SERVER_SIDE) { + errno = EINVAL; return -1; + } entries = &map->server_entries; i -= WL_SERVER_ID_START; @@ -275,8 +280,10 @@ wl_map_reserve_new(struct wl_map *map, uint32_t i) count = entries->size / sizeof *start; - if (count < i) + if (count < i) { + errno = EINVAL; return -1; + } if (count == i) { if (!wl_array_add(entries, sizeof *start)) @@ -287,6 +294,7 @@ wl_map_reserve_new(struct wl_map *map, uint32_t i) } else { start = entries->data; if (start[i].data != NULL) { + errno = EINVAL; return -1; } } |
