Aucbvax.4629
fa.unix-wizards
utzoo!decvax!ucbvax!unix-wizards
Fri Oct 23 19:45:18 1981
stdio(fdopen)
>From dsp.dove@MIT-SPEECH@MIT-AI Fri Oct 23 17:06:30 1981
I just tripped over a "feature" of the stdio package.  I was setting up a cu.c
with buffering and trying to get it to recover after an interrupt while it
was sending a file.  It turns out that once IOERR is set in the _iob
associated with the stream it must be closed to clear the error and allow
further output (yuk).  It had been opened by using fdopen on a previously
opened fd for output, so I had it call fclose and fdopen again.  Well, that
didn't work because fdopen just associates the stream with the fd without
dup'ing the fd, so the close closed the fd and the subsequent fdopen referred
to a now invalid fd (which it didn't test for validity)!  Wonderful!!!
-------

-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <[email protected]>
of http://communication.ucsd.edu/A-News/


This Usenet Oldnews Archive
article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.