Date: Thu, 26 Feb 2004 15:49:48 -0600 (CST) From: Chris Mikkelson <cmikk@tig.oss.uswest.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/63413: dbm_delete return value incorrect Message-ID: <200402262149.i1QLnmcn010993@tig.oss.uswest.net> Resent-Message-ID: <200402262150.i1QLoJDk024178@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402262149.i1QLnmcn010993>