Re: [PATCH] Fix checkout of large files to network shares under Windows XP
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Apr 20, 2010, 12:57 UTC
- Message-ID
- <4BCDA49C.4090405@viscovery.net>
- In-Reply-To
- <t2xbdca99241004200542ud4e8ea5azcad918c37bcacf1a@mail.gmail.com>
Am 4/20/2010 14:42, schrieb Sebastian Schuberth:
Show 8 quoted lines
> On Mon, Apr 19, 2010 at 22:43, René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote: >> Shouldn't the loop be left in the successful case, too? write(2) is >> allowed to write less than requested, so the caller already needs to >> deal with that case anyway. > > I prefer to make the wrapper as transparent as possible. If a direct > call to write would not write less than requested, the wrapper should > not either.
Sure, but René meant the opposite case: When fewer bytes than requested were written, then you shouldn't retry to write more! That is, you should exit the loop when write(fd, buf, n) does not return n.
I still find your code unnecessarily hard to read. In particular, you should extract the non-problematic case out of the loop. If you followed my suggestion elsewhere in the thread, you wouldn't have to write any conditionals that 'break' out of a loop.
-- Hannes