[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CVS update [cvs1-11-x-branch]: /ccvs/src/

From: Mark D. Baushke
Subject: Re: CVS update [cvs1-11-x-branch]: /ccvs/src/
Date: Wed, 25 Aug 2004 13:01:08 -0700

Hash: SHA1

Derek Robert Price <address@hidden> writes:

> Hey Mark,
> This is better than before and it would probably take a larger file
> than you built in sanity.sh to prove it, but I believe this can still
> lose data.  Just because select returned ready for the file descriptor
> doesn't mean that the descriptor is necessarily ready for LEN bytes of
> data.  fwrite() is defined to return the number of bytes written.
> Assuming that works when the file is in non-blocking mode, then this
> code will probably need to loop over remaining bytes until everything
> is written.

I was under the impression that fwrite() returned the number of objects
written that were of size bytes... We are only asking to write one
object in our calls to fwrite.

So, as our current calls are asking to write one object of size bytes
and there is no way to know how many bytes were actually written when
the fwrite operation completes.
> CC'ing bug-cvs in case anyone can correct me or expound.

As Larry has already mentioned, mixing file descriptor operations (like
select) with stdio is not a 'safe' thing to do.

In an ideal world, we would probably move away from using the stdio
library entirely and use raw file operations such as the write() and
select() and pay close attention to the return values.

        -- Mark
Version: GnuPG v1.2.3 (FreeBSD)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]