Except for the historic dbm, ndbm, and hsearch interfaces, Berkeley DB does not use the global variable errno to return error values. The return values for all Berkeley DB functions are grouped into the following three categories:
0 A return value of 0 indicates that the operation was successful.
> 0 A return value that is greater than 0 indicates that there was a system error. The errno value returned by the system is returned by the function; for example, when a Berkeley DB function is unable to allocate memory, the return value from the function will be ENOMEM.
< 0 A return value that is less than 0 indicates a condition that was not a system failure, but was not an unqualified success, either. For example, ...