[haiku-commits] Re: haiku: hrev46743 - src/kits/network/libnetapi src/apps/haiku-depot/textview headers/private/kernel/util src/apps/haiku-depot

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 23 Jan 2014 11:18:35 +0100 (CET)

> On January 23, 2014 at 10:22 AM Stephan Aßmus <superstippi@xxxxxx> wrote:
> > The code is still not really correct, though; a chunkSize of zero would
> > just mean EOF, and it would return B_OK this way, which probably isn't
> > what should happen.
> >
> > Why not just check for "chunkSize < 0" there, and use the
> > "transferredSize != size" to return an additional error (not sure if
> > there is one for "unexpected EOF" yet)?
> Ok, is hrev46748 better?

Slightly :-)
There is still the problem that the file size might change between GetSize(),
and the (end of the) copying loop.
In this case, you will now return a B_IO_ERROR, even though the complete file
might have been copied successfully, just with a different size than originally
anticipated. I'm not even sure the latter qualifies as an error.

Bye,
   Axel.

Other related posts: