libc/locale: Use O_CLOEXEC when opening locale tables

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2021-07-29 09:14:50 -04:00
parent 2411ac0b89
commit 98bfb9dac2
2 changed files with 2 additions and 2 deletions

View File

@ -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);
}

View File

@ -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);
}