Eric Blake <[EMAIL PROTECTED]> writes: > +#elif HAVE___FPURGE > + /* __fpurge has no return value, so we must check errno. */ > + errno = 0; > + __fpurge (stream); > + if (errno) > + result = EOF; > + else > + { > + result = 0; > + errno = e1; > + }
This doesn't look right. __fpurge is not documented to set errno on Solaris, and I suspect it sets errno to garbage. I would just call __fpurge and ignore errno here. > + /* Set position of underlying fd first; hopefully we don't confuse > + the stdio routines. */ > + else if (lseek (fileno (stream), position, SEEK_SET) != position > + || fseeko (stream, position, SEEK_SET) != 0) I don't get the logic here. Why call both lseek and fseeko? Won't fseeko suffice? I think the lseek might cause problems.