+ if (size != iosize)
+ flags |= __SNPT;
+
+ /*
+ * Fix up the FILE fields, and set __cleanup for output flush on
+ * exit (since we are buffered in some way). If in r/w mode, go
+ * to the intermediate state, so that everyone has to call
+ * __srefill or __swsetup on the first operation -- it is more
+ * trouble than it is worth to set things up correctly here.
+ */
+ if (mode == _IOLBF)
+ flags |= __SLBF;
+ if (flags & __SRW)
+ flags &= ~(__SRD | __SWR);
+ fp->_w = 0;
+ fp->_flags = flags;
+ fp->_bf._base = fp->_p = (unsigned char *)buf;
+ fp->_bf._size = size;
+ fp->_lbfsize = 0;
+ __cleanup = _cleanup;