Bruno Haible <br...@clisp.org> writes:

> Let me update the uses of the module 'read-file' in Gnulib.
> I think the next weekly CI run would have caught this.

Thank you; I completely missed those uses in Gnulib.

On a different note, it was suggested to disable stdio buffering if
RF_SENSITIVE is set.  I am attaching a patch for this.

>From 9165e495461db91b8abc42661fc543784d26d0d6 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <u...@gnu.org>
Date: Fri, 29 May 2020 05:45:40 +0200
Subject: [PATCH] read-file: disable buffering if RF_SENSITIVE is set

* lib/read-file.c (read_file): Call setvbuf if RF_SENSITIVE.
Suggested by Glenn Strauss.
---
 ChangeLog       | 6 ++++++
 lib/read-file.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 77c637414..0a0e2301a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-29  Daiki Ueno  <u...@gnu.org>
+
+	read-file: disable buffering if RF_SENSITIVE is set
+	* lib/read-file.c (read_file): Call setvbuf if RF_SENSITIVE.
+	Suggested by Glenn Strauss.
+
 2020-05-29  Daiki Ueno  <u...@gnu.org>
 
 	fopen-gnu-tests: fix "\x" escape usage
diff --git a/lib/read-file.c b/lib/read-file.c
index 36780cc15..3520cbb7b 100644
--- a/lib/read-file.c
+++ b/lib/read-file.c
@@ -195,6 +195,9 @@ read_file (const char *filename, int flags, size_t *length)
   if (!stream)
     return NULL;
 
+  if (flags & RF_SENSITIVE)
+    setvbuf (stream, NULL, _IONBF, 0);
+
   out = fread_file (stream, flags, length);
 
   save_errno = errno;
-- 
2.26.2

Regards,
-- 
Daiki Ueno

Reply via email to