On Sun, 16 Mar 2008 22:39:55 +0100, Eduard Bloch <[EMAIL PROTECTED]> wrote:

#include <hallo.h>
* Jiří Paleček [Sun, Mar 16 2008, 09:10:20PM]:
tags 471110 +patch
thanks

Hello,

I have found out this problem was due to bad handling of EINTR and EAGAIN
error values. The attached patch fixes it.

Hello,

thanks for the problem identification. On the first glance your patch
breaks the semantics of acbuf members for weak reasons, and I don't like

I changed the semantics of acbuf members because it was broken in the first place. For example, look at the return value of read:

+-----+---------------------+
|> 0  | success, ret=number |
|     | of bytes            |
+-----+---------------------+
|= 0  | end of              |
|     | transfer            |
+-----+---------------------+
|< 0  | fatal error,        |
|     | transfer aborted    |
+-----+---------------------+

There is simply not a place for benign errors which indicate the request failed but retries will be possible and eventually succeed. I changed it only so that the negative return value indicates the error code (by returning Exxxx as -Exxxx), so the caller can check and distinguish fatal conditions from benign ones. You could read errno in the caller, but that is, I think, more fragile. You could also throw an exception, which would be a superior solution, but you don't seem to use exceptions in the code, so that's up to you.

Note that I also modified all the places calling these functions, so they should be OK.

that (especially such a change is not properly documented). I think I
will rewrite some parts while integrating it.

OK.

Regards
    Jiri Palecek


Reply via email to