diff options
author | Daiki Ueno <ueno@gnu.org> | 2020-05-25 10:09:28 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2020-05-30 11:10:11 +0200 |
commit | 96f2687b8073cdcf667e9fd8d237f44a1434348b (patch) | |
tree | 8ab75e142b0b72a07bcfbc91cf34c0a171958ee2 /lib/file.c | |
parent | 5b4989dc8e292b4a7e66ee3a1d6be7ad3abf6654 (diff) | |
download | gnutls-96f2687b8073cdcf667e9fd8d237f44a1434348b.tar.gz |
lib: avoid file descriptor leak when application forks
This makes use of the "e" flag of fopen, provided by the Gnulib's
fopen-gnu module.
Reported by Remi Denis-Courmont in:
https://gitlab.com/gnutls/gnutls/-/issues/985
and fix suggested by Tim Rühsen.
Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/file.c')
-rw-r--r-- | lib/file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/file.c b/lib/file.c index 2bcdee8b7e..03aa265c38 100644 --- a/lib/file.c +++ b/lib/file.c @@ -29,7 +29,7 @@ int _gnutls_file_exists(const char *file) { FILE *fd; - fd = fopen(file, "r"); + fd = fopen(file, "re"); if (fd == NULL) return -1; |