From: Bruno Haible Date: Tue, 26 May 2020 15:51:03 +0000 (+0200) Subject: bitset: Make more robust in multithreaded applications. X-Git-Tag: v1.0~4060 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a599a058a0d1c0d62ae811c9c5a17e6690887d8a;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 4b51128a21..44b62166ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-05-27 Bruno Haible + + 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 read-file: add RF_SENSITIVE flag diff --git a/lib/bitset/stats.c b/lib/bitset/stats.c index 10aa5d768d..5bd44c06a4 100644 --- a/lib/bitset/stats.c +++ b/lib/bitset/stats.c @@ -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), diff --git a/modules/bitset b/modules/bitset index ec7f34b60a..20c680634b 100644 --- a/modules/bitset +++ b/modules/bitset @@ -19,6 +19,7 @@ lib/bitset/vector.h Depends-on: attribute c99 +fopen-gnu gettext-h obstack xalloc