From: Bruno Haible Date: Wed, 27 May 2020 17:46:45 +0000 (+0200) Subject: javacomp: Make more robust in multithreaded applications. X-Git-Tag: v1.0~4041 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=19a916addbdfb5d7b639c1fcab0dbef4198b7aed;p=gnulib.git javacomp: Make more robust in multithreaded applications. * lib/javacomp.c (get_classfile_version): Pass an O_CLOEXEC flag to open(). * modules/javacomp (Depends-on): Add 'open'. --- diff --git a/ChangeLog b/ChangeLog index 35518ae62b..906adffe0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-05-28 Bruno Haible + + javacomp: Make more robust in multithreaded applications. + * lib/javacomp.c (get_classfile_version): Pass an O_CLOEXEC flag to + open(). + * modules/javacomp (Depends-on): Add 'open'. + 2020-05-28 Bruno Haible getprogname: Make more robust in multithreaded applications. diff --git a/lib/javacomp.c b/lib/javacomp.c index ac5619637c..4717a5fd7d 100644 --- a/lib/javacomp.c +++ b/lib/javacomp.c @@ -597,7 +597,7 @@ get_classfile_version (const char *compiled_file_name) int fd; /* Open the class file. */ - fd = open (compiled_file_name, O_RDONLY | O_BINARY, 0); + fd = open (compiled_file_name, O_RDONLY | O_BINARY | O_CLOEXEC, 0); if (fd >= 0) { /* Read its first 8 bytes. */ diff --git a/modules/javacomp b/modules/javacomp index fccdaac98e..055279771f 100644 --- a/modules/javacomp +++ b/modules/javacomp @@ -16,6 +16,7 @@ classpath xsetenv sh-quote binary-io +open safe-read xalloc xmalloca