[PATCH] fix endless loop hang in KIO::Connection::read()

Matthias Welwarsky matze at stud.fbi.fh-darmstadt.de
Mon Sep 30 16:48:42 BST 2002

On Monday 30 September 2002 14:22, Stephan Kulow wrote:
> Am Monday 30 September 2002 11:20 schrieb Matthias Welwarsky:
> > hi,
> >
> > this patch prevents and endless loop if the peer unexpectedly closes the
> > connection. However, I wonder if it'd be better to return the number of
> > bytes read so far instead of -1. please comment/commit.
> Hmm, if the peer closes the connection you should get a SIG_PIPE. In what
> slave do you see that? The patch is surely not wrong, but doesn't fix the
> real problem.

Yes, that's what I suspected. It happened in kmail this morning, so I guess 
it's the imap ioslave. If I understand the architecture correctly, 
application and slave communicate via a pipeline, and a "0"-read means that 
the slave didn't deliver as many bytes in the body of the message as it 
announced in the header. I think this might happen if the slave just dies in 
the middle of a transfer.

However, why would one get a SIGPIPE when reading from a pipe? According to 
[Stevens], SIGPIPE is only generated on write(), either on a pipe or on a 


Matthias Welwarsky
Fachschaft Informatik FH Darmstadt
Email: matze at stud.fbi.fh-darmstadt.de

"all software sucks equally, but some software is more equal"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020930/8a612da9/attachment.sig>

More information about the kde-core-devel mailing list