HomeFreeBSD

dbm_nextkey: Always return an error if we've reached the end of the database

Description

dbm_nextkey: Always return an error if we've reached the end of the database

POSIX.1 states that dbm_nextkey must return an invalid key
(i.e., key.dptr == NULL) after the end of the database was reached.
The current implementation of hash_seq will incorrectly restart
the key sequence after the end of the database is reached.

Fix this by checking the "current bucket" index when R_NEXT is passed.

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

Details

Provenance
bnovkovAuthored on Jul 30 2025, 2:39 PM
Reviewer
markj
Differential Revision
D51635: dbm_nextkey: Always return an error if we've reached the end of the database
Parents
rGada5bba476bf: organization.dot: update list of current portmgr members
Branches
Unknown
Tags
Unknown