From 948033c2cdf7124a3caed78d7ca8316daa0c77c5 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Wed, 27 Aug 2008 09:05:01 +0000 Subject: fix write --- lib/base/console.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lib/base/console.cpp') diff --git a/lib/base/console.cpp b/lib/base/console.cpp index c923da52..0a01094b 100644 --- a/lib/base/console.cpp +++ b/lib/base/console.cpp @@ -371,18 +371,17 @@ void eConsoleAppContainer::readyWrite(int what) if (what&eSocketNotifier::Write && outbuf.size() ) { queue_data d = outbuf.front(); - outbuf.pop(); - if ( ::write( fd[1], d.data, d.len ) != d.len ) - { - /* emit */ dataSent(-1); -// eDebug("writeError"); - } + int wr = ::write( fd[1], d.data+d.dataSent, d.len-d.dataSent ); + if (wr < 0) + eDebug("eConsoleAppContainer write failed (%m)"); else + d.dataSent += wr; + if (d.dataSent == d.len) { + outbuf.pop(); + delete [] d.data; /* emit */ dataSent(0); -// eDebug("write ok"); } - delete [] d.data; } if ( !outbuf.size() ) out->stop(); -- cgit v1.2.3