Changeset 45058baa in mainline


Ignore:
Timestamp:
2011-08-16T17:53:09Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
12f9f0d0, db6e419
Parents:
cce8a83
Message:

Use async_data_read() instead of async_data_read_start() to get actual number of bytes read.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/loc.c

    rcce8a83 r45058baa  
    304304        async_exch_t *exch;
    305305        char name_buf[LOC_NAME_MAXLEN + 1];
     306        ipc_call_t dreply;
     307        size_t act_size;
     308        sysarg_t dretval;
    306309       
    307310        *name = NULL;
    308         memset(name_buf, 0, LOC_NAME_MAXLEN + 1);
    309311        exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
    310312       
    311313        ipc_call_t answer;
    312314        aid_t req = async_send_1(exch, LOC_SERVICE_GET_NAME, svc_id, &answer);
    313         int rc = async_data_read_start(exch, name_buf, LOC_NAME_MAXLEN);
    314        
    315         loc_exchange_end(exch);
    316        
    317         if (rc != EOK) {
     315        aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN,
     316            &dreply);
     317        async_wait_for(dreq, &dretval);
     318       
     319        loc_exchange_end(exch);
     320       
     321        if (dretval != EOK) {
    318322                async_wait_for(req, NULL);
    319                 return rc;
     323                return dretval;
    320324        }
    321325       
     
    326330                return retval;
    327331       
     332        act_size = IPC_GET_ARG2(dreply);
     333        assert(act_size <= LOC_NAME_MAXLEN);
     334        name_buf[act_size] = '\0';
     335
    328336        *name = str_dup(name_buf);
    329337        if (*name == NULL)
Note: See TracChangeset for help on using the changeset viewer.