On Wed, May 23, 2001 at 11:39:15AM -0600, Chris Jones wrote:
> No, it could be any number of other things. The first that comes to
> mind is EINTR. How about something closer to:
Hmm. Actually, write(2) shouldn't return EINTR; it should return a
short read count. But other errno values include EDQUOT and EFBIG.
So the code I suggested is not very good, either. Better to just do:
> totalwritten = 0;
> while(totalwritten < expectedbytecount) {
> lastwritten = write(...);
> if(lastwritten == -1) {
> /* errno is guaranteed to be set */
> unlink(tmp);
> elog(...);
> break;
> } else {
> /* we got a partial write count. No problem; try again. */
> totalwritten += lastwritten;
> }
> }
Chris
--
[EMAIL PROTECTED] -----------------------------------------------------
Chris Jones SRI International, Inc.
www.sri.com
PGP signature
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl