[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] ios: call `fflush' on output streams
From: |
Mohammad-Reza Nabipoor |
Subject: |
[PATCH] ios: call `fflush' on output streams |
Date: |
Fri, 3 Feb 2023 01:25:35 +0100 |
2023-02-03 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
* libpoke/ios-dev-stream.c (ios_dev_stream_flush): Call `fflush'
when user calls `flush' on output streams.
---
ChangeLog | 5 +++++
libpoke/ios-dev-stream.c | 6 ++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index becafbc7..546f6cab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-02-03 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
+
+ * libpoke/ios-dev-stream.c (ios_dev_stream_flush): Call `fflush'
+ when user calls `flush' on output streams.
+
2023-02-03 Jose E. Marchesi <jemarch@gnu.org>
* libpoke/pkl-rt.pk (_pkl_64x64_128): New function.
diff --git a/libpoke/ios-dev-stream.c b/libpoke/ios-dev-stream.c
index 952af51e..873833be 100644
--- a/libpoke/ios-dev-stream.c
+++ b/libpoke/ios-dev-stream.c
@@ -249,12 +249,14 @@ static int
ios_dev_stream_flush (void *iod, ios_dev_off offset)
{
struct ios_dev_stream *sio = iod;
+
+ if (sio->flags & IOS_F_WRITE)
+ fflush (sio->file);
if (sio->flags & IOS_F_READ
&& offset > ios_buffer_get_begin_offset (sio->buffer)
&& offset <= ios_buffer_get_end_offset (sio->buffer))
return ios_buffer_forget_till (sio->buffer, offset);
- else
- return IOS_OK;
+ return IOS_OK;
}
struct ios_dev_if ios_dev_stream =
--
2.39.1
- [PATCH] ios: call `fflush' on output streams,
Mohammad-Reza Nabipoor <=