connection: Clear correct args when clearing fds to -1
commit 52609ddf79a96fee0465006e2c6339a3a5d23a87 was intended to
set fds to -1 in the arg list, however it failed to account for
version information at the start of signatures.
Most noticably, this broke mesa's create_prime_buffer by setting
width to -1 instead of the fd, as the width was the argument
following the fd, and the version was one byte long.
This should close https://bugs.kde.org/show_bug.cgi?id=389200
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Derek Foreman authored 6 years ago
Daniel Stone committed 6 years ago
532 | 532 | static void |
533 | 533 | wl_closure_clear_fds(struct wl_closure *closure) |
534 | 534 | { |
535 | const char *signature = closure->message->signature; | |
536 | struct argument_details arg; | |
535 | 537 | int i; |
536 | 538 | |
537 | for (i = 0; closure->message->signature[i]; i++) { | |
538 | if (closure->message->signature[i] == 'h') | |
539 | for (i = 0; i < closure->count; i++) { | |
540 | signature = get_next_argument(signature, &arg); | |
541 | if (arg.type == 'h') | |
539 | 542 | closure->args[i].h = -1; |
540 | 543 | } |
541 | 544 | } |