Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144802774
D34007.id101905.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
849 B
Referenced Files
None
Subscribers
None
D34007.id101905.diff
View Options
diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c
--- a/lib/libc/stdio/fflush.c
+++ b/lib/libc/stdio/fflush.c
@@ -105,8 +105,8 @@
int
__sflush(FILE *fp)
{
- unsigned char *p;
- int n, t;
+ unsigned char *p, *old_p;
+ int n, t, old_w;
t = fp->_flags;
if ((t & __SWR) == 0)
@@ -121,7 +121,9 @@
* Set these immediately to avoid problems with longjmp and to allow
* exchange buffering (via setvbuf) in user write function.
*/
+ old_p = fp->_p;
fp->_p = p;
+ old_w = fp->_w;
fp->_w = t & (__SLBF|__SNBF) ? 0 : fp->_bf._size;
for (; n > 0; n -= t, p += t) {
@@ -134,6 +136,9 @@
fp->_p += n;
if ((fp->_flags & (__SLBF | __SNBF)) == 0)
fp->_w -= n;
+ } else if (p == fp->_p) { /* cond. to handle setvbuf */
+ fp->_p = old_p;
+ fp->_w = old_w;
}
fp->_flags |= __SERR;
return (EOF);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 13, 7:43 PM (19 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28680305
Default Alt Text
D34007.id101905.diff (849 B)
Attached To
Mode
D34007: __sflush(): on write error, if nothing was written, reset FILE state back
Attached
Detach File
Event Timeline
Log In to Comment