summaryrefslogtreecommitdiff
path: root/lib/gc-gnulib.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-05-27 19:38:36 +0200
committerBruno Haible <bruno@clisp.org>2020-05-28 21:39:50 +0200
commit520a9d23e25b4e4ca109f7e264faa40b641d7094 (patch)
treef1857c6c49f2c0fbcda0bd9d0fb4b80e81e3203a /lib/gc-gnulib.c
parenta2fe36d527ab98e3a586ff3c830cbe9271f988c3 (diff)
downloadgnulib-520a9d23e25b4e4ca109f7e264faa40b641d7094.tar.gz
crypto/gc: Make more robust in multithreaded applications.
* lib/gc-gnulib.c (randomize): Pass an O_CLOEXEC flag to open(). * modules/crypto/gc (Depends-on): Add 'open'.
Diffstat (limited to 'lib/gc-gnulib.c')
-rw-r--r--lib/gc-gnulib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gc-gnulib.c b/lib/gc-gnulib.c
index bb62ab1502..8e9b88f075 100644
--- a/lib/gc-gnulib.c
+++ b/lib/gc-gnulib.c
@@ -167,7 +167,7 @@ randomize (int level, char *data, size_t datalen)
if (strcmp (device, "no") == 0)
return GC_RANDOM_ERROR;
- fd = open (device, O_RDONLY);
+ fd = open (device, O_RDONLY | O_CLOEXEC);
if (fd < 0)
return GC_RANDOM_ERROR;