From a9ea7088e35a3479c83f0aaa6858ef0281b2a89f Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 24 Jun 2010 21:48:52 +0000 Subject: [PATCH] 2010-06-24 Joel Sherrill * libcsupport/src/read.c, libcsupport/src/write.c: read(2) and write(2) should return 0 when passed a count of 0 after verifying other possible errors. --- cpukit/ChangeLog | 6 ++++++ cpukit/libcsupport/src/read.c | 4 +++- cpukit/libcsupport/src/write.c | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index c368d7101b..db4f81cb0e 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,9 @@ +2010-06-24 Joel Sherrill + + * libcsupport/src/read.c, libcsupport/src/write.c: read(2) and write(2) + should return 0 when passed a count of 0 after verifying other + possible errors. + 2010-06-24 Joel Sherrill * libfs/src/imfs/imfs_creat.c: Fix warning. diff --git a/cpukit/libcsupport/src/read.c b/cpukit/libcsupport/src/read.c index 4e44eec4ff..34d07085b6 100644 --- a/cpukit/libcsupport/src/read.c +++ b/cpukit/libcsupport/src/read.c @@ -34,10 +34,12 @@ ssize_t read( rtems_libio_check_count( count ); rtems_libio_check_permissions( iop, LIBIO_FLAGS_READ ); + if ( count == 0 ) + return 0; + /* * Now process the read(). */ - if ( !iop->handlers->read_h ) rtems_set_errno_and_return_minus_one( ENOTSUP ); diff --git a/cpukit/libcsupport/src/write.c b/cpukit/libcsupport/src/write.c index 3bda204015..0193466bd5 100644 --- a/cpukit/libcsupport/src/write.c +++ b/cpukit/libcsupport/src/write.c @@ -41,10 +41,12 @@ ssize_t write( rtems_libio_check_count( count ); rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); + if ( count == 0 ) + return 0; + /* * Now process the write() request. */ - if ( !iop->handlers->write_h ) rtems_set_errno_and_return_minus_one( ENOTSUP );