[PATCH] libcsupport: Accept NULL for zero-length entries

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Dec 17 10:00:41 UTC 2013


---
 cpukit/libcsupport/include/rtems/libio_.h |    2 +-
 testsuites/psxtests/psxrdwrv/test.c       |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h
index 995d621..78a57c8 100644
--- a/cpukit/libcsupport/include/rtems/libio_.h
+++ b/cpukit/libcsupport/include/rtems/libio_.h
@@ -887,7 +887,7 @@ static inline ssize_t rtems_libio_iovec_eval(
 
     total += ( ssize_t ) len;
 
-    if ( iov[ v ].iov_base == NULL ) {
+    if ( iov[ v ].iov_base == NULL && len != 0 ) {
       rtems_set_errno_and_return_minus_one( EINVAL );
     }
   }
diff --git a/testsuites/psxtests/psxrdwrv/test.c b/testsuites/psxtests/psxrdwrv/test.c
index 0e06674..181d9d4 100644
--- a/testsuites/psxtests/psxrdwrv/test.c
+++ b/testsuites/psxtests/psxrdwrv/test.c
@@ -361,7 +361,7 @@ int doErrorTest(void)
   /*  writev --  all zero length buffers */
   vec[0].iov_base = vec;
   vec[0].iov_len = 0;
-  vec[1].iov_base = vec;
+  vec[1].iov_base = NULL;
   vec[1].iov_len = 0;
   puts("writev iov_len works with no effect -- OK");
   rc = writev(fd, vec, 2);
@@ -374,7 +374,7 @@ int doErrorTest(void)
   /*  readv --  all zero length buffers */
   vec[0].iov_base = vec;
   vec[0].iov_len = 0;
-  vec[1].iov_base = vec;
+  vec[1].iov_base = NULL;
   vec[1].iov_len = 0;
   puts("readv iov_len works with no effect -- OK");
   rc = readv(fd, vec, 2);
-- 
1.7.7




More information about the devel mailing list