change log for rtems (2011-07-22)

rtems-vc at rtems.org rtems-vc at rtems.org
Fri Jul 22 16:10:13 UTC 2011


 *joel*:
2011-07-22	Joel Sherrill <joel.sherrilL at 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/ftruncate.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.

M 1.2887  cpukit/ChangeLog
M   1.43  cpukit/libcsupport/include/rtems/libio_.h
M   1.12  cpukit/libcsupport/src/fchdir.c
M   1.13  cpukit/libcsupport/src/fdatasync.c
M   1.10  cpukit/libcsupport/src/fpathconf.c
M   1.14  cpukit/libcsupport/src/fsync.c
M   1.15  cpukit/libcsupport/src/ftruncate.c
M   1.20  cpukit/libcsupport/src/read.c
M    1.8  cpukit/libcsupport/src/readv.c
M   1.21  cpukit/libcsupport/src/write.c
M    1.7  cpukit/libcsupport/src/writev.c

diff -u rtems/cpukit/ChangeLog:1.2886 rtems/cpukit/ChangeLog:1.2887
--- rtems/cpukit/ChangeLog:1.2886	Thu Jul 21 10:35:13 2011
+++ rtems/cpukit/ChangeLog	Fri Jul 22 11:04:38 2011
@@ -1,3 +1,14 @@
+2011-07-22	Joel Sherrill <joel.sherrilL at 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/ftruncate.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-21	Sebastian Huber <sebastian.huber at embedded-brains.de>
 
 	* libnetworking/rtems/rtems_showipstat.c: Print IP input queue drops.

diff -u rtems/cpukit/libcsupport/include/rtems/libio_.h:1.42 rtems/cpukit/libcsupport/include/rtems/libio_.h:1.43
--- rtems/cpukit/libcsupport/include/rtems/libio_.h:1.42	Thu Jul 21 07:03:25 2011
+++ rtems/cpukit/libcsupport/include/rtems/libio_.h	Fri Jul 22 11:04:38 2011
@@ -123,20 +123,31 @@
   } while (0)
 
 /*
- *  rtems_libio_check_permissions
+ *  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(_iop, _flag)          \
+#define rtems_libio_check_permissions_with_error(_iop, _flag, _errno) \
   do {                                                      \
       if (((_iop)->flags & (_flag)) == 0) {                 \
-            rtems_set_errno_and_return_minus_one( EINVAL ); \
+            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) \
+   rtems_libio_check_permissions_with_error(_iop, _flag, EINVAL )
+
+/*
  *  rtems_filesystem_freenode
  *
  *  Macro to free a node.

diff -u rtems/cpukit/libcsupport/src/fchdir.c:1.11 rtems/cpukit/libcsupport/src/fchdir.c:1.12
--- rtems/cpukit/libcsupport/src/fchdir.c:1.11	Thu Jul  1 10:12:36 2010
+++ rtems/cpukit/libcsupport/src/fchdir.c	Fri Jul 22 11:04:38 2011
@@ -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
@@ -36,12 +36,6 @@
   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.
    */
 

diff -u rtems/cpukit/libcsupport/src/fdatasync.c:1.12 rtems/cpukit/libcsupport/src/fdatasync.c:1.13
--- rtems/cpukit/libcsupport/src/fdatasync.c:1.12	Thu Jul 15 03:10:47 2010
+++ rtems/cpukit/libcsupport/src/fdatasync.c	Fri Jul 22 11:04:38 2011
@@ -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 @@
   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().

diff -u rtems/cpukit/libcsupport/src/fpathconf.c:1.9 rtems/cpukit/libcsupport/src/fpathconf.c:1.10
--- rtems/cpukit/libcsupport/src/fpathconf.c:1.9	Thu Sep  4 13:54:13 2003
+++ rtems/cpukit/libcsupport/src/fpathconf.c	Fri Jul 22 11:04:38 2011
@@ -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 @@
   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.

diff -u rtems/cpukit/libcsupport/src/fsync.c:1.13 rtems/cpukit/libcsupport/src/fsync.c:1.14
--- rtems/cpukit/libcsupport/src/fsync.c:1.13	Thu Jul 15 03:10:47 2010
+++ rtems/cpukit/libcsupport/src/fsync.c	Fri Jul 22 11:04:38 2011
@@ -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 @@
   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().

diff -u rtems/cpukit/libcsupport/src/ftruncate.c:1.14 rtems/cpukit/libcsupport/src/ftruncate.c:1.15
--- rtems/cpukit/libcsupport/src/ftruncate.c:1.14	Thu Jul 15 03:10:47 2010
+++ rtems/cpukit/libcsupport/src/ftruncate.c	Fri Jul 22 11:04:38 2011
@@ -32,6 +32,7 @@
   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 ftruncate() request.
@@ -45,7 +46,5 @@
   if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY )
     rtems_set_errno_and_return_minus_one( EISDIR );
 
-  rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
-
   return (*iop->pathinfo.handlers->ftruncate_h)( iop, length );
 }

diff -u rtems/cpukit/libcsupport/src/read.c:1.19 rtems/cpukit/libcsupport/src/read.c:1.20
--- rtems/cpukit/libcsupport/src/read.c:1.19	Mon Aug 23 18:19:31 2010
+++ rtems/cpukit/libcsupport/src/read.c	Fri Jul 22 11:04:38 2011
@@ -1,7 +1,7 @@
 /*
  *  read() - POSIX 1003.1b 6.4.1 - Read From a File
  *
- *  COPYRIGHT (c) 1989-2010.
+ *  COPYRIGHT (c) 1989-2011.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -32,7 +32,7 @@
   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().

diff -u rtems/cpukit/libcsupport/src/readv.c:1.7 rtems/cpukit/libcsupport/src/readv.c:1.8
--- rtems/cpukit/libcsupport/src/readv.c:1.7	Wed Aug 25 17:25:18 2010
+++ rtems/cpukit/libcsupport/src/readv.c	Fri Jul 22 11:04:38 2011
@@ -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 @@
   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

diff -u rtems/cpukit/libcsupport/src/write.c:1.20 rtems/cpukit/libcsupport/src/write.c:1.21
--- rtems/cpukit/libcsupport/src/write.c:1.20	Mon Aug 23 18:19:31 2010
+++ rtems/cpukit/libcsupport/src/write.c	Fri Jul 22 11:04:38 2011
@@ -1,7 +1,7 @@
 /*
  *  write() - POSIX 1003.1b 6.4.2 - Write to a File
  *
- *  COPYRIGHT (c) 1989-2010.
+ *  COPYRIGHT (c) 1989-2011.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -39,7 +39,7 @@
   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.

diff -u rtems/cpukit/libcsupport/src/writev.c:1.6 rtems/cpukit/libcsupport/src/writev.c:1.7
--- rtems/cpukit/libcsupport/src/writev.c:1.6	Wed Aug 25 17:25:18 2010
+++ rtems/cpukit/libcsupport/src/writev.c	Fri Jul 22 11:04:38 2011
@@ -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 @@
   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



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110722/a897fb20/attachment-0001.html>


More information about the vc mailing list