Page MenuHomeFreeBSD

db/hash.c: Do not return an error when opening a missing database with O_CREAT
ClosedPublic

Authored by bnovkov on Jul 24 2025, 3:52 PM.
Tags
None
Referenced Files
F174771362: D51491.id159056.diff
Mon, Oct 5, 9:45 PM
Unknown Object (File)
Mon, Oct 5, 6:22 PM
Unknown Object (File)
Mon, Oct 5, 3:39 PM
Unknown Object (File)
Mon, Oct 5, 3:10 AM
Unknown Object (File)
Wed, Sep 16, 5:30 AM
Unknown Object (File)
Aug 20 2026, 12:44 PM
Unknown Object (File)
Aug 15 2026, 1:32 AM
Unknown Object (File)
Aug 12 2026, 2:54 PM
Subscribers

Details

Summary

dbm_open currently returns an error when opening a missing database
with O_CREAT but creates the request database file. This is caused
by a buggy check in __hash_open which attempts to detect a new
(or empty) database file, but fails to take the O_CREAT flag into
account.

Fix this by expanding the check to include O_CREAT.

Fixes: edcdc752ecdd
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable