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
commite220c107f413f435af20323a957996f1021997ef (patch)
tree876d01e75cd802ed4d67876979a0de00b04bd077 /io
parentaba873aebf1aebdb6b4b87ca471bebc1e90391d6 (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 c38fb0555..cbabb95be 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();