summaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2011-01-13 12:50:28 +0100
committersb <sb@openoffice.org>2011-01-13 12:50:28 +0100
commit7bf5ab295e38ecdde42245ad8732cdf9c05ebcba (patch)
tree8f2c0e7693a86a1aa9d5cb59cffd8de4080ff606 /io
parentd06639e31ca2bac549ed1c6a06f14f750aa2584a (diff)
sb139: #i116444# handle short reads in io_acceptor::PipeConnection::read
Diffstat (limited to 'io')
-rw-r--r--io/source/acceptor/acc_pipe.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx
index 6d0b77484fef..63f688d32dca 100644
--- a/io/source/acceptor/acc_pipe.cxx
+++ b/io/source/acceptor/acc_pipe.cxx
@@ -101,11 +101,17 @@ namespace io_acceptor
{
if( ! m_nStatus )
{
- if( aReadBytes.getLength() != nBytesToRead )
+ if( aReadBytes.getLength() < nBytesToRead )
{
aReadBytes.realloc( nBytesToRead );
}
- return m_pipe.read( aReadBytes.getArray() , aReadBytes.getLength() );
+ sal_Int32 n = m_pipe.read( aReadBytes.getArray(), nBytesToRead );
+ OSL_ASSERT( n >= 0 && n <= aReadBytes.getLength() );
+ if( n < aReadBytes.getLength() )
+ {
+ aReadBytes.realloc( n );
+ }
+ return n;
}
else {
throw IOException();