mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
util: set errno in wl_map_reserve_new()
And also fix wl_connection_demarshal() to pass through that errno. Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
This commit is contained in:
parent
ae263cca3e
commit
03e8a1f84b
2 changed files with 17 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue