Summary: | [libc] [patch] dbm_delete returns -1 instead of 1 when the key does not exist in the database. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | GB Clark <gclarkii> | ||||||
Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||||
Status: | Closed Works As Intended | ||||||||
Severity: | Affects Only Me | CC: | delphij, pfg | ||||||
Priority: | Normal | ||||||||
Version: | 4.6-STABLE | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
GB Clark
2002-09-04 21:30:01 UTC
Hello, Here is a patch to correct the bug. GB -- GB Clark II | Roaming FreeBSD Admin gclarkii@VSServices.COM | General Geek CTHULU for President - Why choose the lesser of two evils? Created attachment 153190 [details]
Update patch
(In reply to gclarkii from comment #0) The proposed change is wrong, unfortunately. It's the manual page that should be corrected instead. To quote POSIX [1]: " RETURN VALUE The dbm_store() and dbm_delete() functions shall return 0 when they succeed and a negative value when they fail. " So, we must return a negative value, and -1 is one of the valid return values. 1 on the other hand is not. I have also checked Solaris and GDBM's implementation of the same interface and they all return -1. [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_clearerr.html A commit references this bug: Author: pfg Date: Fri Feb 20 01:31:11 UTC 2015 New revision: 279037 URL: https://svnweb.freebsd.org/changeset/base/279037 Log: dbm_delete(3) correct man page to match current behaviour. "The dbm_store() and dbm_delete() functions shall return 0 when they succeed and a negative value when they fail." Reference: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_clearerr.html PR: 42422 Suggested by: delphij MFC after: 3 days Changes: head/lib/libc/db/man/dbm.3 (In reply to Xin LI from comment #3) Good catch! POSIX doesn't seem to leave space for the description in the man page. I also confirmed with the NetBSD code. A commit references this bug: Author: pfg Date: Mon Mar 23 19:50:22 UTC 2015 New revision: 280394 URL: https://svnweb.freebsd.org/changeset/base/280394 Log: MFC r279037: dbm_delete(3): correct man page to match current behaviour. "The dbm_store() and dbm_delete() functions shall return 0 when they succeed and a negative value when they fail." Reference: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_clearerr.html PR: 42422 Suggested by: delphij Changes: _U stable/10/ stable/10/lib/libc/db/man/dbm.3 A commit references this bug: Author: pfg Date: Mon Mar 23 19:53:38 UTC 2015 New revision: 280395 URL: https://svnweb.freebsd.org/changeset/base/280395 Log: MFC r279037: dbm_delete(3): correct man page to match current behaviour. "The dbm_store() and dbm_delete() functions shall return 0 when they succeed and a negative value when they fail." Reference: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_clearerr.html PR: 42422 Suggested by: delphij Changes: _U stable/9/lib/libc/ stable/9/lib/libc/db/man/dbm.3 Updated the manpage. |