Changeset c1d8ee4 in rtems


Ignore:
Timestamp:
Dec 17, 2013, 9:59:13 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
1464599
Parents:
56bea43
git-author:
Sebastian Huber <sebastian.huber@…> (12/17/13 09:59:13)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/20/13 09:31:53)
Message:

libcsupport: Accept NULL for zero-length entries

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/include/rtems/libio_.h

    r56bea43 rc1d8ee4  
    888888    total += ( ssize_t ) len;
    889889
    890     if ( iov[ v ].iov_base == NULL ) {
     890    if ( iov[ v ].iov_base == NULL && len != 0 ) {
    891891      rtems_set_errno_and_return_minus_one( EINVAL );
    892892    }
  • cpukit/libfs/src/defaults/default_readv.c

    r56bea43 rc1d8ee4  
    4242
    4343  for ( v = 0 ; v < iovcnt ; ++v ) {
    44     ssize_t bytes = ( *iop->pathinfo.handlers->read_h )(
    45       iop,
    46       iov[ v ].iov_base,
    47       iov[ v ].iov_len
    48     );
     44    size_t len = iov[ v ].iov_len;
    4945
    50     if ( bytes < 0 )
    51       return -1;
     46    if ( len > 0 ) {
     47      ssize_t bytes = ( *iop->pathinfo.handlers->read_h )(
     48        iop,
     49        iov[ v ].iov_base,
     50        len
     51      );
    5252
    53     total += bytes;
     53      if ( bytes < 0 )
     54        return -1;
    5455
    55     if ( bytes != iov[ v ].iov_len )
    56       break;
     56      total += bytes;
     57
     58      if ( bytes != ( ssize_t ) len )
     59        break;
     60    }
    5761  }
    5862
  • cpukit/libfs/src/defaults/default_writev.c

    r56bea43 rc1d8ee4  
    4242
    4343  for ( v = 0 ; v < iovcnt ; ++v ) {
    44     ssize_t bytes = ( *iop->pathinfo.handlers->write_h )(
    45       iop,
    46       iov[ v ].iov_base,
    47       iov[ v ].iov_len
    48     );
     44    size_t len = iov[ v ].iov_len;
    4945
    50     if ( bytes < 0 )
    51       return -1;
     46    if ( len > 0 ) {
     47      ssize_t bytes = ( *iop->pathinfo.handlers->write_h )(
     48        iop,
     49        iov[ v ].iov_base,
     50        len
     51      );
    5252
    53     total += bytes;
     53      if ( bytes < 0 )
     54        return -1;
    5455
    55     if ( bytes != iov[ v ].iov_len )
    56       break;
     56      total += bytes;
     57
     58      if ( bytes != ( ssize_t ) len )
     59        break;
     60    }
    5761  }
    5862
  • testsuites/psxtests/psxrdwrv/test.c

    r56bea43 rc1d8ee4  
    362362  vec[0].iov_base = vec;
    363363  vec[0].iov_len = 0;
    364   vec[1].iov_base = vec;
     364  vec[1].iov_base = NULL;
    365365  vec[1].iov_len = 0;
    366366  puts("writev iov_len works with no effect -- OK");
     
    375375  vec[0].iov_base = vec;
    376376  vec[0].iov_len = 0;
    377   vec[1].iov_base = vec;
     377  vec[1].iov_base = NULL;
    378378  vec[1].iov_len = 0;
    379379  puts("readv iov_len works with no effect -- OK");
Note: See TracChangeset for help on using the changeset viewer.