Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107121488
D42491.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D42491.diff
View Options
diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c
--- a/lib/libc/stdio/fvwrite.c
+++ b/lib/libc/stdio/fvwrite.c
@@ -51,7 +51,6 @@
__sfvwrite(FILE *fp, struct __suio *uio)
{
size_t len;
- unsigned char *old_p;
char *p;
struct __siov *iov;
int w, s;
@@ -135,12 +134,8 @@
COPY(w);
/* fp->_w -= w; */ /* unneeded */
fp->_p += w;
- old_p = fp->_p;
- if (__fflush(fp) == EOF) {
- if (old_p == fp->_p)
- fp->_p -= w;
+ if (__fflush(fp))
goto err;
- }
} else if (len >= (w = fp->_bf._size)) {
/* write directly */
w = _swrite(fp, p, w);
@@ -179,12 +174,8 @@
COPY(w);
/* fp->_w -= w; */
fp->_p += w;
- old_p = fp->_p;
- if (__fflush(fp) == EOF) {
- if (old_p == fp->_p)
- fp->_p -= w;
+ if (__fflush(fp))
goto err;
- }
} else if (s >= (w = fp->_bf._size)) {
w = _swrite(fp, p, w);
if (w <= 0)
diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c
--- a/lib/libc/stdio/wbuf.c
+++ b/lib/libc/stdio/wbuf.c
@@ -49,7 +49,6 @@
int
__swbuf(int c, FILE *fp)
{
- unsigned char *old_p;
int n;
/*
@@ -85,15 +84,8 @@
}
fp->_w--;
*fp->_p++ = c;
- old_p = fp->_p;
- if (++n == fp->_bf._size || (fp->_flags & __SLBF && c == '\n')) {
- if (__fflush(fp) != 0) {
- if (fp->_p == old_p) {
- fp->_p--;
- fp->_w++;
- }
+ if (++n == fp->_bf._size || (fp->_flags & __SLBF && c == '\n'))
+ if (__fflush(fp) != 0)
return (EOF);
- }
- }
return (c);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 10:59 AM (3 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15753140
Default Alt Text
D42491.diff (1 KB)
Attached To
Mode
D42491: fflush: correct buffer handling in __sflush
Attached
Detach File
Event Timeline
Log In to Comment