- f->mode |= f->mode+1;
-
- /* Fail if unreadable or writing and unable to flush */
- if ((f->flags & (F_ERR|F_NORD)) || (f->wpos && __oflow(f))) {
- FUNLOCK(f);
- return EOF;
- }
-
- /* Clear write mode */
- f->wpos = f->wstop = f->wend = 0;
-
- /* Put the file in read mode */
- if (!f->rpos) f->rpos = f->rend = f->buf;