HomeFreeBSD

db/hash.c: Allow O_WRONLY in dbm_open

Description

db/hash.c: Allow O_WRONLY in dbm_open

The dbm(3) manpage explicitly states that O_WRONLY is not allowed in
dbm_open, but a more recent comment in __hash_open suggests otherwise.
Furthermore, POSIX.1 allows O_WRONLY in dbm_open and states
that the underlying file must be opened for both reading and writing.

Fix this by correcting the O_WRONLY check and moving it further into
the function to make sure that the original flags are stored in hashp.

Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D51514

Details

Provenance
bnovkovAuthored on Jul 25 2025, 9:01 AM
Reviewer
markj
Differential Revision
D51514: db/hash.c: Allow O_WRONLY in dbm_open
Parents
rG7fc218b30b80: find: Put back clearing the NOSTAT bit
Branches
Unknown
Tags
Unknown