Changeset 2d733c42 in rtems for cpukit/include


Ignore:
Timestamp:
Jan 20, 1999, 3:48:22 PM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
f91b8df1
Parents:
5f22d091
Message:

More general fix based on bug report and patch from Ian Lance Taylor
<ian@…> to fix this problem:

There is a small bug in rtems_close in c/src/lib/libc/libio.c. It
does not check whether the file descriptor it is passed is open. This
can cause it to make a null dereference if it is passed a file
descriptor which is in the valid range but which was not opened, or
which was already closed.

File:
1 edited

Legend:

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

    r5f22d091 r2d733c42  
    104104         &rtems_libio_iops[_fd] : 0)
    105105
     106/* 
     107 *  rtems_libio_check_is_open
     108 * 
     109 *  Macro to check if a file descriptor is actually open.
     110 */
     111
     112#define rtems_libio_check_is_open(_iop) \
     113  do {                                               \
     114      if (((_iop)->flags & LIBIO_FLAGS_OPEN) == 0) { \
     115          errno = EBADF;                             \
     116          return -1;                                 \
     117      }                                              \
     118  } while (0)
     119
    106120/*
    107121 *  rtems_libio_check_fd
     
    119133
    120134/*
    121  *  rtems_libio_check_fd
     135 *  rtems_libio_check_buffer
    122136 *
    123137 *  Macro to check if a buffer pointer is valid.
Note: See TracChangeset for help on using the changeset viewer.