From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 0B5D21F55B for ; Tue, 26 May 2020 16:10:03 +0000 (UTC) Received: from localhost ([::1]:58490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdc9R-0006re-QE for normalperson@yhbt.net; Tue, 26 May 2020 12:10:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdc8e-0005kH-SS for bug-gnulib@gnu.org; Tue, 26 May 2020 12:09:13 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::1]:12557) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdc8c-0005z9-0U; Tue, 26 May 2020 12:09:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1590509345; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=1tJQyc5TeSVd0o7ReTA/PtED+gTBWZspxq+IkrIM7dk=; b=iQRYjmBV91+u8YH52B7Sky7rszbi2wxRF7LZvg2w89yKfj9OnwOL/07U9REZ4WKCjY 6gKXYcF1jLpNgY7YS3sOfmvsA5rC7q2QRlkkvUCIa8ITD2kFtqZKcXamBNsqLPT4kHg9 YAPGH6B8NNLrtL32rKSulaMMaw4HezIFEn27E+nEGuqpdpt5BQINr5Lii9j6WkcHgjOg rkzKVbVEgjh3Aoic6HI2lDDEYRQMgaJ7asfSNV6TWAw18aKiymYoOWq4iIFNMrbqRlJe /ao16ecYAW+xfnf/+Xk0tKU58qFDMYJbR2OBqx7KCJA1eO7vSYtChTlxzU1HBckX8pSB ajiQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOH6fzxfs=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 46.7.0 DYNA|AUTH) with ESMTPSA id x0bd30w4QG94daM (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Tue, 26 May 2020 18:09:04 +0200 (CEST) From: Bruno Haible To: Daiki Ueno Subject: Re: portability of fopen and 'e' (O_CLOEXEC) flag Date: Tue, 26 May 2020 18:09:03 +0200 Message-ID: <2446740.5YXOBombHr@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <2318672.ckYohbHQXy@omega> References: <7d7cfa6e-af75-82d0-e076-bf411b87a3ab@gmx.de> <87367nfd5d.fsf-ueno@gnu.org> <2318672.ckYohbHQXy@omega> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart1883596.zflVdr4a51" Content-Transfer-Encoding: 7Bit Received-SPF: none client-ip=2a01:238:20a:202:5300::1; envelope-from=bruno@clisp.org; helo=mo6-p00-ob.smtp.rzone.de X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim =?ISO-8859-1?Q?R=FChsen?= , bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" This is a multi-part message in MIME format. --nextPart1883596.zflVdr4a51 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi Daiki, > > Thank you for this; would it make sense to use it in the modules that do > > one-shot fopen/fclose, such as read-file? Here are proposed patches for other modules. Does this look right? Note: The patch to sethostname.c is only relevant for Minix. Minix does not have multithreading now, but a future version likely will. Bruno --nextPart1883596.zflVdr4a51 Content-Disposition: attachment; filename="0001-bitset-Make-more-robust-in-multithreaded-application.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-bitset-Make-more-robust-in-multithreaded-application.patch" >From acb3be326fbbeaf82af33fbd7bb7b3cb180d2616 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 26 May 2020 17:51:03 +0200 Subject: [PATCH 1/8] 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. --- ChangeLog | 7 +++++++ lib/bitset/stats.c | 4 ++-- modules/bitset | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07d4d51..ca9fbb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-05-26 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-26 Daiki Ueno read-file: make use of fopen-gnu diff --git a/lib/bitset/stats.c b/lib/bitset/stats.c index 10aa5d7..5bd44c0 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 ec7f34b..20c6806 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 -- 2.7.4 --nextPart1883596.zflVdr4a51 Content-Disposition: attachment; filename="0002-exclude-Make-more-robust-in-multithreaded-applicatio.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0002-exclude-Make-more-robust-in-multithreaded-applicatio.patch" >From 67d0dc62291be365765dac3fb9e8c006d8427097 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 26 May 2020 17:52:23 +0200 Subject: [PATCH 2/8] exclude: Make more robust in multithreaded applications. * lib/exclude.c (add_exclude_file): Pass an 'e' flag to fopen. * modules/exclude (Depends-on): Add fopen-gnu. --- ChangeLog | 6 ++++++ lib/exclude.c | 2 +- modules/exclude | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ca9fbb3..e766479 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2020-05-26 Bruno Haible + exclude: Make more robust in multithreaded applications. + * lib/exclude.c (add_exclude_file): Pass an 'e' flag to fopen. + * modules/exclude (Depends-on): Add fopen-gnu. + +2020-05-26 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. diff --git a/lib/exclude.c b/lib/exclude.c index c63c004..2b57a9b 100644 --- a/lib/exclude.c +++ b/lib/exclude.c @@ -683,7 +683,7 @@ add_exclude_file (void (*add_func) (struct exclude *, char const *, int), if (use_stdin) in = stdin; - else if (! (in = fopen (file_name, "r"))) + else if (! (in = fopen (file_name, "re"))) return -1; rc = add_exclude_fp (call_addfn, ex, in, options, line_end, &add_func); diff --git a/modules/exclude b/modules/exclude index 5ff0539..8fe2708 100644 --- a/modules/exclude +++ b/modules/exclude @@ -8,6 +8,7 @@ lib/exclude.c Depends-on: filename fnmatch +fopen-gnu hash mbscasecmp mbuiter -- 2.7.4 --nextPart1883596.zflVdr4a51 Content-Disposition: attachment; filename="0003-getloadavg-Make-more-robust-in-multithreaded-applica.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0003-getloadavg-Make-more-robust-in-multithreaded-applica.patch" >From 350c6f8dba8cc2a6266cb8a350d01c49805af9db Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 26 May 2020 17:53:47 +0200 Subject: [PATCH 3/8] getloadavg: Make more robust in multithreaded applications. * lib/getloadavg.c (getloadavg): Pass an 'e' flag to fopen. * modules/getloadavg (Depends-on): Add fopen-gnu. --- ChangeLog | 6 ++++++ lib/getloadavg.c | 2 +- modules/getloadavg | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e766479..7dabc5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2020-05-26 Bruno Haible + getloadavg: Make more robust in multithreaded applications. + * lib/getloadavg.c (getloadavg): Pass an 'e' flag to fopen. + * modules/getloadavg (Depends-on): Add fopen-gnu. + +2020-05-26 Bruno Haible + exclude: Make more robust in multithreaded applications. * lib/exclude.c (add_exclude_file): Pass an 'e' flag to fopen. * modules/exclude (Depends-on): Add fopen-gnu. diff --git a/lib/getloadavg.c b/lib/getloadavg.c index ebb6f5d..7e11c32 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -569,7 +569,7 @@ getloadavg (double loadavg[], int nelem) int count; FILE *fp; - fp = fopen (NETBSD_LDAV_FILE, "r"); + fp = fopen (NETBSD_LDAV_FILE, "re"); if (fp == NULL) return -1; count = fscanf (fp, "%lu %lu %lu %lu\n", diff --git a/modules/getloadavg b/modules/getloadavg index 1b0f581..e14ddc8 100644 --- a/modules/getloadavg +++ b/modules/getloadavg @@ -7,6 +7,7 @@ m4/getloadavg.m4 Depends-on: extensions +fopen-gnu intprops stdbool stdlib -- 2.7.4 --nextPart1883596.zflVdr4a51 Content-Disposition: attachment; filename="0004-getpass-Make-more-robust-in-multithreaded-applicatio.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0004-getpass-Make-more-robust-in-multithreaded-applicatio.patch" >From 54e5d001797c755994968a34259bae745ee515e6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 26 May 2020 17:56:31 +0200 Subject: [PATCH 4/8] getpass: Make more robust in multithreaded applications. * lib/getpass.c (getpass): Pass an 'e' flag to fopen. * modules/getpass (Depends-on): Add fopen-gnu. --- ChangeLog | 6 ++++++ lib/getpass.c | 2 +- modules/getpass | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7dabc5e..93d8b5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2020-05-26 Bruno Haible + getpass: Make more robust in multithreaded applications. + * lib/getpass.c (getpass): Pass an 'e' flag to fopen. + * modules/getpass (Depends-on): Add fopen-gnu. + +2020-05-26 Bruno Haible + getloadavg: Make more robust in multithreaded applications. * lib/getloadavg.c (getloadavg): Pass an 'e' flag to fopen. * modules/getloadavg (Depends-on): Add fopen-gnu. diff --git a/lib/getpass.c b/lib/getpass.c index af8d72e..3b0552e 100644 --- a/lib/getpass.c +++ b/lib/getpass.c @@ -96,7 +96,7 @@ getpass (const char *prompt) /* Try to write to and read from the terminal if we can. If we can't open the terminal, use stderr and stdin. */ - tty = fopen ("/dev/tty", "w+"); + tty = fopen ("/dev/tty", "w+e"); if (tty == NULL) { in = stdin; diff --git a/modules/getpass b/modules/getpass index 7e73451..74d781a 100644 --- a/modules/getpass +++ b/modules/getpass @@ -9,6 +9,7 @@ m4/getpass.m4 Depends-on: unistd extensions +fopen-gnu fseeko getline stdbool -- 2.7.4 --nextPart1883596.zflVdr4a51 Content-Disposition: attachment; filename="0005-readutmp-Make-more-robust-in-multithreaded-applicati.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0005-readutmp-Make-more-robust-in-multithreaded-applicati.patch" >From 56bcba9b1013176d52f1b25a3085695a3bd8d9b8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 26 May 2020 17:57:58 +0200 Subject: [PATCH 5/8] 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. --- ChangeLog | 6 ++++++ lib/readutmp.c | 2 +- modules/readutmp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 93d8b5a..893d080 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2020-05-26 Bruno Haible + 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-26 Bruno Haible + getpass: Make more robust in multithreaded applications. * lib/getpass.c (getpass): Pass an 'e' flag to fopen. * modules/getpass (Depends-on): Add fopen-gnu. diff --git a/lib/readutmp.c b/lib/readutmp.c index 308390d..793d480 100644 --- a/lib/readutmp.c +++ b/lib/readutmp.c @@ -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; diff --git a/modules/readutmp b/modules/readutmp index 51f6290..e88897c 100644 --- a/modules/readutmp +++ b/modules/readutmp @@ -11,6 +11,7 @@ extensions xalloc stdbool stdint +fopen-gnu configure.ac: gl_READUTMP -- 2.7.4 --nextPart1883596.zflVdr4a51 Content-Disposition: attachment; filename="0006-sethostname-Make-more-robust-in-multithreaded-applic.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0006-sethostname-Make-more-robust-in-multithreaded-applic.patch" >From acdcd9f872f5338f901a9019627953dcb5e8d95f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 26 May 2020 18:00:04 +0200 Subject: [PATCH 6/8] sethostname: Make more robust in multithreaded applications. * lib/sethostname.c (sethostname): Pass an 'e' flag to fopen. * modules/sethostname (Depends-on): Add fopen-gnu. --- ChangeLog | 6 ++++++ lib/sethostname.c | 2 +- modules/sethostname | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 893d080..162b861 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2020-05-26 Bruno Haible + sethostname: Make more robust in multithreaded applications. + * lib/sethostname.c (sethostname): Pass an 'e' flag to fopen. + * modules/sethostname (Depends-on): Add fopen-gnu. + +2020-05-26 Bruno Haible + 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. diff --git a/lib/sethostname.c b/lib/sethostname.c index 87b3af9..1be69be 100644 --- a/lib/sethostname.c +++ b/lib/sethostname.c @@ -52,7 +52,7 @@ sethostname (const char *name, size_t len) these are appropriate for us to set, even if they may match the situation, during failed open/write/close operations, so we leave errno alone and rely on what the system sets up. */ - hostf = fopen ("/etc/hostname.file", "w"); + hostf = fopen ("/etc/hostname.file", "we"); if (hostf == NULL) r = -1; else diff --git a/modules/sethostname b/modules/sethostname index f3c0d13..92b4a2b 100644 --- a/modules/sethostname +++ b/modules/sethostname @@ -9,6 +9,7 @@ m4/gethostname.m4 Depends-on: unistd errno [test $HAVE_SETHOSTNAME = 0] +fopen-gnu [test $HAVE_SETHOSTNAME = 0] configure.ac: gl_FUNC_SETHOSTNAME -- 2.7.4 --nextPart1883596.zflVdr4a51 Content-Disposition: attachment; filename="0007-mountlist-Make-more-robust-in-multithreaded-applicat.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0007-mountlist-Make-more-robust-in-multithreaded-applicat.patch" >From 7fac4fbbd7203d2fcf3be257872e3c7508b86402 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 26 May 2020 18:04:26 +0200 Subject: [PATCH 7/8] mountlist: Make more robust in multithreaded applications. * lib/mountlist.c (setmntent, read_file_system_list): Pass an 'e' flag to fopen. * modules/mountlist (Depends-on): Add fopen-gnu. --- ChangeLog | 7 +++++++ lib/mountlist.c | 10 +++++----- modules/mountlist | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 162b861..b30f4b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2020-05-26 Bruno Haible + mountlist: Make more robust in multithreaded applications. + * lib/mountlist.c (setmntent, read_file_system_list): Pass an 'e' flag + to fopen. + * modules/mountlist (Depends-on): Add fopen-gnu. + +2020-05-26 Bruno Haible + sethostname: Make more robust in multithreaded applications. * lib/sethostname.c (sethostname): Pass an 'e' flag to fopen. * modules/sethostname (Depends-on): Add fopen-gnu. diff --git a/lib/mountlist.c b/lib/mountlist.c index 7abe024..4cb19c8 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -125,7 +125,7 @@ #ifdef MOUNTED_GETMNTENT1 # if !HAVE_SETMNTENT /* Android <= 4.4 */ -# define setmntent(fp,mode) fopen (fp, mode) +# define setmntent(fp,mode) fopen (fp, mode "e") # endif # if !HAVE_ENDMNTENT /* Android <= 4.4 */ # define endmntent(fp) fclose (fp) @@ -460,7 +460,7 @@ read_file_system_list (bool need_fs_type) (and that code is in previous versions of this function), however libmount depends on libselinux which pulls in many dependencies. */ char const *mountinfo = "/proc/self/mountinfo"; - fp = fopen (mountinfo, "r"); + fp = fopen (mountinfo, "re"); if (fp != NULL) { char *line = NULL; @@ -794,7 +794,7 @@ read_file_system_list (bool need_fs_type) char *table = "/etc/mnttab"; FILE *fp; - fp = fopen (table, "r"); + fp = fopen (table, "re"); if (fp == NULL) return NULL; @@ -852,7 +852,7 @@ read_file_system_list (bool need_fs_type) by the kernel. */ errno = 0; - fp = fopen (table, "r"); + fp = fopen (table, "re"); if (fp == NULL) ret = errno; else @@ -924,7 +924,7 @@ read_file_system_list (bool need_fs_type) # endif errno = 0; - fp = fopen (table, "r"); + fp = fopen (table, "re"); if (fp == NULL) ret = errno; else diff --git a/modules/mountlist b/modules/mountlist index 11cf809..5bb45ed 100644 --- a/modules/mountlist +++ b/modules/mountlist @@ -8,6 +8,7 @@ m4/fstypename.m4 m4/mountlist.m4 Depends-on: +fopen-gnu getline stdbool stdint -- 2.7.4 --nextPart1883596.zflVdr4a51 Content-Disposition: attachment; filename="0008-javacomp-Make-more-robust-in-multithreaded-applicati.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0008-javacomp-Make-more-robust-in-multithreaded-applicati.patch" >From 0f0f1ad56a75eb04e091ba84a6707b4431eeb68e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 26 May 2020 18:05:34 +0200 Subject: [PATCH 8/8] javacomp: Make more robust in multithreaded applications. * lib/javacomp.c (write_temp_file): Pass an 'e' flag to fopen_temp. * modules/javacomp (Depends-on): Add fopen-gnu. --- ChangeLog | 6 ++++++ lib/javacomp.c | 2 +- modules/javacomp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b30f4b1..b95b945 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2020-05-26 Bruno Haible + javacomp: Make more robust in multithreaded applications. + * lib/javacomp.c (write_temp_file): Pass an 'e' flag to fopen_temp. + * modules/javacomp (Depends-on): Add fopen-gnu. + +2020-05-26 Bruno Haible + mountlist: Make more robust in multithreaded applications. * lib/mountlist.c (setmntent, read_file_system_list): Pass an 'e' flag to fopen. diff --git a/lib/javacomp.c b/lib/javacomp.c index 9239616..ac56196 100644 --- a/lib/javacomp.c +++ b/lib/javacomp.c @@ -573,7 +573,7 @@ write_temp_file (struct temp_dir *tmpdir, const char *file_name, FILE *fp; register_temp_file (tmpdir, file_name); - fp = fopen_temp (file_name, "w"); + fp = fopen_temp (file_name, "we"); if (fp == NULL) { error (0, errno, _("failed to create \"%s\""), file_name); diff --git a/modules/javacomp b/modules/javacomp index 4f49bd9..fccdaac 100644 --- a/modules/javacomp +++ b/modules/javacomp @@ -22,6 +22,7 @@ xmalloca getline xconcat-filename fwriteerror +fopen-gnu clean-temp stat error -- 2.7.4 --nextPart1883596.zflVdr4a51--