Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Aug 2021 12:45:30 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d88815784447 - stable/13 - libc/locale: Use O_CLOEXEC when opening locale tables
Message-ID:  <202108051245.175CjUTE072910@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=d88815784447d24216bafeefa973da4e0ae5db14

commit d88815784447d24216bafeefa973da4e0ae5db14
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-07-29 13:14:50 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-08-05 12:45:22 +0000

    libc/locale: Use O_CLOEXEC when opening locale tables
    
    Reviewed by:    kib
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 98bfb9dac28585fb5629c5fc951ce0d83490d446)
---
 lib/libc/locale/collate.c | 2 +-
 lib/libc/locale/rune.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c
index c992d2299ab7..7afb2043e6a4 100644
--- a/lib/libc/locale/collate.c
+++ b/lib/libc/locale/collate.c
@@ -131,7 +131,7 @@ __collate_load_tables_l(const char *encoding, struct xlocale_collate *table)
 	if (asprintf(&buf, "%s/%s/LC_COLLATE", _PathLocale, encoding) == -1)
 		return (_LDP_ERROR);
 
-	if ((fd = _open(buf, O_RDONLY)) < 0) {
+	if ((fd = _open(buf, O_RDONLY | O_CLOEXEC)) < 0) {
 		free(buf);
 		return (_LDP_ERROR);
 	}
diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c
index b7334636f654..ce2095763eba 100644
--- a/lib/libc/locale/rune.c
+++ b/lib/libc/locale/rune.c
@@ -74,7 +74,7 @@ _Read_RuneMagi(const char *fname)
 	int runetype_ext_len = 0;
 	int fd;
 
-	if ((fd = _open(fname, O_RDONLY)) < 0) {
+	if ((fd = _open(fname, O_RDONLY | O_CLOEXEC)) < 0) {
 		errno = EINVAL;
 		return (NULL);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108051245.175CjUTE072910>