Changeset 8fb674b in mainline for uspace/srv/hid/input/input.c


Ignore:
Timestamp:
2020-12-31T21:27:13Z (3 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Parents:
6a208fc
git-author:
Matthieu Riolo <matthieu.riolo@…> (2020-06-27 19:08:36)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2020-12-31 21:27:13)
Message:

correcting usage of async_data_read_receive() in srv/input

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/input.c

    r6a208fc r8fb674b  
    5050#include <ipc/input.h>
    5151#include <loc.h>
     52#include <macros.h>
    5253#include <ns.h>
    5354#include <stdbool.h>
     
    157158        const char *layout_name = layout_active->name;
    158159        size_t length = str_size(layout_name) + 1;
    159         ipc_call_t id;
    160 
    161         async_answer_1(call, EOK, length);
    162         if (async_data_read_receive(&id, NULL)) {
    163                 async_data_read_finalize(&id, layout_name, length);
    164         }
     160        ipc_call_t rec_call;
     161
     162        size_t max_size;
     163        if (!async_data_read_receive(&rec_call, &max_size)) {
     164                async_answer_0(&rec_call, EREFUSED);
     165                async_answer_0(call, EREFUSED);
     166                return;
     167        }
     168
     169        errno_t rc = async_data_read_finalize(&rec_call, layout_name,
     170            min(length, max_size));
     171        async_answer_0(call, rc);
    165172}
    166173
Note: See TracChangeset for help on using the changeset viewer.