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

ChangeLog
lib/bitset/stats.c
modules/bitset

index 4b51128a21c52b9bb66443893be42cf4ae4bc40b..44b62166ab38c0615c9d98cc7d01c97a049fb00c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-27  Bruno Haible  <bruno@clisp.org>
+
+       bitset: Make more robust in multithreaded applications.
+       * lib/bitset/stats.c (bitset_stats_read, bitset_stats_write): Pass an
+       'e' flag to fopen.
+       * modules/bitset (Depends-on): Add fopen-gnu.
+
 2020-05-27  Daiki Ueno  <ueno@gnu.org>
 
        read-file: add RF_SENSITIVE flag
index 10aa5d768dc1853f04368913dc68286cfec527b8..5bd44c06a4892115d7cbdf6fadf79d3c5243010b 100644 (file)
@@ -245,7 +245,7 @@ bitset_stats_read (const char *file_name)
   if (!file_name)
     file_name = BITSET_STATS_FILE;
 
-  FILE *file = fopen (file_name, "r");
+  FILE *file = fopen (file_name, "re");
   if (file)
     {
       if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
@@ -273,7 +273,7 @@ bitset_stats_write (const char *file_name)
   if (!file_name)
     file_name = BITSET_STATS_FILE;
 
-  FILE *file = fopen (file_name, "w");
+  FILE *file = fopen (file_name, "we");
   if (file)
     {
       if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
index ec7f34b60a2b79bdbad3fc43d055cc578845e78f..20c680634b0f2717b9a2691b0d730415d73d5bc8 100644 (file)
@@ -19,6 +19,7 @@ lib/bitset/vector.h
 Depends-on:
 attribute
 c99
+fopen-gnu
 gettext-h
 obstack
 xalloc