In article <[email protected]>, Alan Barrett <[email protected]> wrote: >On Thu, 06 May 2010, Christos Zoulas wrote: >> > The fileno() function may fail if: >> > >> > [EBADF] >> > The stream argument is not a valid stream, or the stream is not >> > associated with a file. >> > >> >Isn't the above EBADF exactly what you are after? >> >> Our stdio supports funopen() which has FILE *'s where fileno() == -1, but >> they work just fine... This should be documented. Perhaps set errno if >> it is indeed a bad file descriptor, and don't set it if it is a side-effect >> of funopen()? > >It seems to me that funopen() creates a stream that is not associated >with a file descriptor. I assume that's what POSIX meant by "... not >associated with a file". So, I think that EBADF would be a reasonable >response. > >Returning -1 without setting errno seems very wrong. Seting errno >to some value that we think is more appropriate than EBADF would >probably be OK.
ENOTTY ;-) EOPNOTSUPP christos
