mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
2011-07-24 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1839/filesystem * libcsupport/include/rtems/libio_.h, libcsupport/src/fchdir.c, libcsupport/src/fdatasync.c, libcsupport/src/fpathconf.c, libcsupport/src/fsync.c, libcsupport/src/read.c, libcsupport/src/readv.c, libcsupport/src/write.c, libcsupport/src/writev.c: Some calls did not return proper status for permission errors or incorrectly permissions at all.
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
2011-07-24 Joel Sherrill <joel.sherrilL@OARcorp.com>
|
||||
|
||||
PR 1839/filesystem
|
||||
* libcsupport/include/rtems/libio_.h, libcsupport/src/fchdir.c,
|
||||
libcsupport/src/fdatasync.c, libcsupport/src/fpathconf.c,
|
||||
libcsupport/src/fsync.c, libcsupport/src/read.c,
|
||||
libcsupport/src/readv.c, libcsupport/src/write.c,
|
||||
libcsupport/src/writev.c: Some calls did not return proper status for
|
||||
permission errors or incorrectly permissions at all.
|
||||
|
||||
2011-07-19 Joel Sherrill <joel.sherrilL@OARcorp.com>
|
||||
|
||||
PR 1838/filesystem
|
||||
|
||||
@@ -123,19 +123,30 @@ extern rtems_libio_t *rtems_libio_iop_freelist;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* rtems_libio_check_permissions_with_error
|
||||
*
|
||||
* Macro to check if a file descriptor is open for this operation.
|
||||
* On failure, return the user specified error.
|
||||
*/
|
||||
|
||||
#define rtems_libio_check_permissions_with_error(_iop, _flag, _errno) \
|
||||
do { \
|
||||
if (((_iop)->flags & (_flag)) == 0) { \
|
||||
rtems_set_errno_and_return_minus_one( _errno ); \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* rtems_libio_check_permissions
|
||||
*
|
||||
* Macro to check if a file descriptor is open for this operation.
|
||||
* On failure, return EINVAL
|
||||
*/
|
||||
|
||||
#define rtems_libio_check_permissions(_iop, _flag) \
|
||||
do { \
|
||||
if (((_iop)->flags & (_flag)) == 0) { \
|
||||
rtems_set_errno_and_return_minus_one( EINVAL ); \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
#define rtems_libio_check_permissions(_iop, _flag) \
|
||||
rtems_libio_check_permissions_with_error(_iop, _flag, EINVAL )
|
||||
|
||||
/*
|
||||
* rtems_filesystem_freenode
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* fchdir() - compatible with SVr4, 4.4BSD and X/OPEN - Change Directory
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2000.
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -35,12 +35,6 @@ int fchdir(
|
||||
iop = rtems_libio_iop( fd );
|
||||
rtems_libio_check_is_open(iop);
|
||||
|
||||
/*
|
||||
* Now process the fchmod().
|
||||
*/
|
||||
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_READ );
|
||||
|
||||
/*
|
||||
* Verify you can change directory into this node.
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* fdatasync() - POSIX 1003.1b 6.6.2 - Synchronize the Data of a File
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -29,7 +29,7 @@ int fdatasync(
|
||||
rtems_libio_check_fd( fd );
|
||||
iop = rtems_libio_iop( fd );
|
||||
rtems_libio_check_is_open(iop);
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_WRITE, EBADF );
|
||||
|
||||
/*
|
||||
* Now process the fdatasync().
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* fpathconf() - POSIX 1003.1b - 5.7.1 - Configurable Pathname Varables
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -33,7 +33,6 @@ long fpathconf(
|
||||
rtems_libio_check_fd(fd);
|
||||
iop = rtems_libio_iop(fd);
|
||||
rtems_libio_check_is_open(iop);
|
||||
rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ);
|
||||
|
||||
/*
|
||||
* Now process the information request.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* fsync() - POSIX 1003.1b 6.6.1 - Synchronize the State of a File
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -29,7 +29,6 @@ int fsync(
|
||||
rtems_libio_check_fd( fd );
|
||||
iop = rtems_libio_iop( fd );
|
||||
rtems_libio_check_is_open(iop);
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
|
||||
/*
|
||||
* Now process the fsync().
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* read() - POSIX 1003.1b 6.4.1 - Read From a File
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -32,7 +32,7 @@ ssize_t read(
|
||||
rtems_libio_check_is_open( iop );
|
||||
rtems_libio_check_buffer( buffer );
|
||||
rtems_libio_check_count( count );
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_READ );
|
||||
rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_READ, EBADF );
|
||||
|
||||
/*
|
||||
* Now process the read().
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* http://www.opengroup.org/onlinepubs/009695399/functions/readv.html
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -40,7 +40,7 @@ ssize_t readv(
|
||||
rtems_libio_check_fd( fd );
|
||||
iop = rtems_libio_iop( fd );
|
||||
rtems_libio_check_is_open( iop );
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_READ );
|
||||
rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_READ, EBADF );
|
||||
|
||||
/*
|
||||
* Argument validation on IO vector
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* write() - POSIX 1003.1b 6.4.2 - Write to a File
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -39,7 +39,7 @@ ssize_t write(
|
||||
rtems_libio_check_is_open( iop );
|
||||
rtems_libio_check_buffer( buffer );
|
||||
rtems_libio_check_count( count );
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_WRITE, EBADF );
|
||||
|
||||
/*
|
||||
* Now process the write() request.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* http://www.opengroup.org/onlinepubs/009695399/functions/writev.html
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -41,7 +41,7 @@ ssize_t writev(
|
||||
rtems_libio_check_fd( fd );
|
||||
iop = rtems_libio_iop( fd );
|
||||
rtems_libio_check_is_open( iop );
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_WRITE, EBADF );
|
||||
|
||||
/*
|
||||
* Argument validation on IO vector
|
||||
|
||||
Reference in New Issue
Block a user