The branch main has been updated by des:

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

commit d28e4ce6cb61916b4f6bedcf4205a4da1ae121e1
Author:     Dag-Erling Smørgrav <[email protected]>
AuthorDate: 2025-09-29 11:48:02 +0000
Commit:     Dag-Erling Smørgrav <[email protected]>
CommitDate: 2025-09-29 11:57:32 +0000

    tzcode: Tweak open flags.
    
    Upstream uses a set of flags that reduces to O_RDONLY | O_CLOEXEC when
    you ignore flags that either don't exist in FreeBSD or have no effect.
    We were using O_RDONLY | O_BINARY, which reduces to O_RDONLY.  Add
    O_CLOEXEC.  Also replace O_RDONLY with the more accurate O_SEARCH when
    opening TZDIR.
    
    MFC after:      3 days
    Fixes:          967a49a21a27 ("Update tzcode to 2025b")
---
 contrib/tzcode/localtime.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c
index 8638ac9ba2cd..1668475ea646 100644
--- a/contrib/tzcode/localtime.c
+++ b/contrib/tzcode/localtime.c
@@ -677,7 +677,7 @@ tzloadbody(char const *name, struct state *sp, char 
tzloadflags,
          while (*relname == '/')
            relname++;
        }
-       dd = open(TZDIR, O_DIRECTORY | O_RDONLY);
+       dd = open(TZDIR, O_DIRECTORY | O_SEARCH | O_CLOEXEC);
        if ((tzloadflags & TZLOAD_FROMENV) && issetugid()) {
          if (dd < 0)
            return errno;
@@ -687,14 +687,14 @@ tzloadbody(char const *name, struct state *sp, char 
tzloadflags,
            fid = -1;
            errno = EINVAL;
          } else {
-           fid = openat(dd, relname, O_RDONLY | O_BINARY, AT_RESOLVE_BENEATH);
+           fid = openat(dd, relname, O_RDONLY | O_CLOEXEC | O_RESOLVE_BENEATH);
          }
        } else {
          if (dd < 0) {
            relname = name;
            dd = AT_FDCWD;
          }
-         fid = openat(dd, relname, O_RDONLY | O_BINARY, 0);
+         fid = openat(dd, relname, O_RDONLY | O_CLOEXEC);
        }
        if (dd != AT_FDCWD && dd >= 0) {
          serrno = errno;

Reply via email to