bin/63413: dbm_delete return value incorrect
Chris Mikkelson
cmikk at tig.oss.uswest.net
Thu Feb 26 13:50:20 PST 2004
>Number: 63413
>Category: bin
>Synopsis: dbm_delete return value incorrect
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Feb 26 13:50:19 PST 2004
>Closed-Date:
>Last-Modified:
>Originator: Chris Mikkelson
>Release: FreeBSD 4.9-STABLE i386
>Organization:
>Environment:
System: FreeBSD tig.oss.uswest.net 4.9-STABLE FreeBSD 4.9-STABLE #6: Thu Feb 5 14:57:21 CST 2004 root at tig.oss.uswest.net:/usr/obj/usr/src/sys/TIG i386
>Description:
According to dbm(3) man page, dbm_delete()
returns 0 on success, -1 on error, and 1 if
the key to be deleted did not exist. The
implementation of dbm_delete returns -1 if
the key did not exist.
>How-To-Repeat:
>Fix:
Apply to /usr/src/lib/libc/db/hash/ndbm.c:
--- ndbm.c.orig Thu Feb 26 15:41:46 2004
+++ ndbm.c Thu Feb 26 15:44:01 2004
@@ -160,6 +160,7 @@
* Returns:
* 0 on success
* <0 failure
+ * 1 if entry does not exist
*/
extern int
dbm_delete(db, key)
@@ -171,11 +172,7 @@
dbtkey.data = key.dptr;
dbtkey.size = key.dsize;
- status = (db->del)(db, &dbtkey, 0);
- if (status)
- return (-1);
- else
- return (0);
+ return (db->del)(db, &dbtkey, 0);
}
/*
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list