aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2012-05-12 13:03:16 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2012-05-12 13:03:16 -0700
commitbc953857b46ea7455a639740d751d4ae5569f789 (patch)
tree25a726f37a5622771fbe089dde8608023d09feb2
parent1d0b64a009640e978fe2050317e406254967c7eb (diff)
downloadklibc-bc953857b46ea7455a639740d751d4ae5569f789.tar.gz
[klibc] fflush: discard input data
Match the Linux semantics which is to discard any unused input data on fflush(). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--usr/klibc/stdio/fflush.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr/klibc/stdio/fflush.c b/usr/klibc/stdio/fflush.c
index cade1f2a1028ee..38c708bb33b8a7 100644
--- a/usr/klibc/stdio/fflush.c
+++ b/usr/klibc/stdio/fflush.c
@@ -9,8 +9,9 @@ int __fflush(struct _IO_file_pvt *f)
ssize_t rv;
char *p;
- if (!f->obytes)
- return 0;
+ /* Flush any unused input data */
+ f->pub._io_filepos -= f->ibytes;
+ f->ibytes = 0;
p = f->buf;
while (f->obytes) {