util: set errno in wl_map_insert_at()

And add errno checks in callers, where it seems to be necessary.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
This commit is contained in:
Aleksandr Mezin 2022-02-09 05:36:11 +06:00 committed by Simon Ser
parent 03e8a1f84b
commit 884d5fe3ab
3 changed files with 18 additions and 9 deletions

View file

@ -239,8 +239,10 @@ wl_map_insert_at(struct wl_map *map, uint32_t flags, uint32_t i, void *data)
}
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))