[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] [BUG] serious bug in vu_write_retry?
From: |
Yann Droneaud |
Subject: |
Re: [Gnu-arch-users] [BUG] serious bug in vu_write_retry? |
Date: |
Fri, 09 Jul 2004 19:23:19 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux) |
Tom Lord <address@hidden> writes:
>
> I think this is clearer:
>
> {
> ssize_t amt;
>
> amt = vu_write (errn, fd, buf, count);
> if (amt < 0)
> {
> if ((*errn == EAGAIN) || (*errn == EINTR))
> continue;
> else
> return amt;
> }
> else if (amt == count)
> return orig_count;
> else
> {
> count -= amt;
> buf += amt;
> }
> }
>
> (and will be pushed soon (modulo consideration of abentley's
> alternative return value proposal)).
>
Another version I found cleaner ;)
amt = vu_write (errn, fd, buf, count);
if (amt == count)
return orig_count;
if (amt < 0)
{
if ((*errn == EAGAIN) || (*errn == EINTR))
continue;
else
return amt;
}
else
{
count -= amt;
buf += amt;
}
But this doesn't check for amt == 0,
could this happen ?
--
Yann Droneaud <address@hidden> +33 6 88 40 82 43
<address@hidden> <address@hidden> <address@hidden>
http://droneaud.com/ http://meuh.org/ http://meuh.tuxfamily.org/
1024D/BEA43321 5D91 B5B0 5137 B8FE 6882 FE19 CAA0 6F05 BEA4 3321