]> Savannah Git Hosting - gnulib.git/commitdiff
readutmp: Make more robust in multithreaded applications.
authorBruno Haible <bruno@clisp.org>
Tue, 26 May 2020 15:57:58 +0000 (17:57 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 27 May 2020 17:30:43 +0000 (19:30 +0200)
* lib/readutmp.c (read_utmp): Pass an 'e' flag to fopen.
* modules/readutmp (Depends-on): Add fopen-gnu.

ChangeLog
lib/readutmp.c
modules/readutmp

index a9f542fede306fcb3fb4e5fe1aeba3c961e7d651..8f89928f4f19ce48f43a45aed6a62bf5648d5a10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-27  Bruno Haible  <bruno@clisp.org>
+
+       readutmp: Make more robust in multithreaded applications.
+       * lib/readutmp.c (read_utmp): Pass an 'e' flag to fopen.
+       * modules/readutmp (Depends-on): Add fopen-gnu.
+
 2020-05-27  Bruno Haible  <bruno@clisp.org>
 
        getpass: Make more robust in multithreaded applications.
index 308390de1c45701143fff7003d43981c1f1a2de4..793d480d2938507766f5076db4d66e535f77a5ea 100644 (file)
@@ -132,7 +132,7 @@ read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,
   size_t n_alloc = 0;
   STRUCT_UTMP *utmp = NULL;
   int saved_errno;
-  FILE *f = fopen (file, "r");
+  FILE *f = fopen (file, "re");
 
   if (! f)
     return -1;
index 51f629002b86d3a337e417b89a7cfab354949a24..e88897c999a9ffd8141dc7d8f65fafd922a8ece8 100644 (file)
@@ -11,6 +11,7 @@ extensions
 xalloc
 stdbool
 stdint
+fopen-gnu
 
 configure.ac:
 gl_READUTMP