Changeset 0169e90 in rtems


Ignore:
Timestamp:
Sep 13, 2017, 6:55:05 AM (23 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
48dbb6cf
Parents:
4b759b1
git-author:
Sebastian Huber <sebastian.huber@…> (09/13/17 06:55:05)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/15/17 05:33:43)
Message:

libio: Do simple parameter checks early

This simplifies error handling later.

Update #3132.

Files:
4 edited

Legend:

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

    r4b759b1 r0169e90  
    871871  int            v;
    872872  rtems_libio_t *iop;
    873 
    874   rtems_libio_check_fd( fd );
    875   iop = rtems_libio_iop( fd );
    876   rtems_libio_check_is_open( iop );
    877   rtems_libio_check_permissions_with_error( iop, flags, EBADF );
    878 
    879   *iopp = iop;
    880873
    881874  /*
     
    911904  }
    912905
     906  rtems_libio_check_fd( fd );
     907  iop = rtems_libio_iop( fd );
     908  rtems_libio_check_is_open( iop );
     909  rtems_libio_check_permissions_with_error( iop, flags, EBADF );
     910
     911  *iopp = iop;
     912
    913913  return total;
    914914}
  • cpukit/libcsupport/src/read.c

    r4b759b1 r0169e90  
    3333  rtems_libio_t *iop;
    3434
     35  rtems_libio_check_buffer( buffer );
     36  rtems_libio_check_count( count );
     37
    3538  rtems_libio_check_fd( fd );
    3639  iop = rtems_libio_iop( fd );
    3740  rtems_libio_check_is_open( iop );
    38   rtems_libio_check_buffer( buffer );
    39   rtems_libio_check_count( count );
    4041  rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_READ, EBADF );
    4142
  • cpukit/libcsupport/src/write.c

    r4b759b1 r0169e90  
    3434)
    3535{
    36   rtems_libio_t     *iop;
     36  rtems_libio_t *iop;
     37
     38  rtems_libio_check_buffer( buffer );
     39  rtems_libio_check_count( count );
    3740
    3841  rtems_libio_check_fd( fd );
    3942  iop = rtems_libio_iop( fd );
    4043  rtems_libio_check_is_open( iop );
    41   rtems_libio_check_buffer( buffer );
    42   rtems_libio_check_count( count );
    4344  rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_WRITE, EBADF );
    4445
  • testsuites/psxtests/psxfile02/init.c

    r4b759b1 r0169e90  
    4242{
    4343  struct stat       stat_buff;
    44   struct iovec      vec[4];
     44  struct iovec      vec[2];
     45  char              buf[2][1];
    4546  off_t             res;
    4647  int               status;
     48
     49  vec[0].iov_base = buf[0];
     50  vec[0].iov_len = sizeof(buf[0]);
     51  vec[1].iov_base = buf[1];
     52  vec[1].iov_len = sizeof(buf[1]);
    4753
    4854  printf("ftruncate %s\n", description);
     
    8995
    9096  printf("readv %s\n", description);
    91   status = readv(fd, vec, 4);
     97  status = readv(fd, vec, 2);
    9298  rtems_test_assert( status == -1 );
    9399  printf( "%d: %s\n", errno, strerror( errno ) );
     
    95101
    96102  printf("writev %s\n", description);
    97   status = writev(fd, vec, 4);
     103  status = writev(fd, vec, 2);
    98104  rtems_test_assert( status == -1 );
    99105  printf( "%d: %s\n", errno, strerror( errno ) );
Note: See TracChangeset for help on using the changeset viewer.