From nobody@FreeBSD.org  Wed Sep  4 13:28:40 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C87CB37B400
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  4 Sep 2002 13:28:40 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8492D43E72
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  4 Sep 2002 13:28:40 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g84KSeOT090666
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 4 Sep 2002 13:28:40 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g84KSelW090665;
	Wed, 4 Sep 2002 13:28:40 -0700 (PDT)
Message-Id: <200209042028.g84KSelW090665@www.freebsd.org>
Date: Wed, 4 Sep 2002 13:28:40 -0700 (PDT)
From: GB Clark <gclarkii@vsservices.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: dbm_delete returns -1 instead of 1 when the key does not exist in the database.
X-Send-Pr-Version: www-1.0

>Number:         42422
>Category:       kern
>Synopsis:       [libc] [patch] dbm_delete returns -1 instead of 1 when the key does not exist in the database.
>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:   Wed Sep 04 13:30:01 PDT 2002
>Closed-Date:    
>Last-Modified:  Fri Jun 15 23:56:58 GMT 2007
>Originator:     GB Clark
>Release:        4.6-STABLE
>Organization:
VSS
>Environment:
FreeBSD prime.vsservices.com 4.6-STABLE FreeBSD 4.6-STABLE #0: Thu Aug 22 01:29:14 CDT 2002 gclarkii@prime.vsservices.com:/1002/objtree/usr/src/sys/PRIME i386    
>Description:
dbm_delete is documented to return 1 if the key does NOT exist in the dbm file.
In lib/libc/db/ndmb.c it returns -1 or 0 only. 
>How-To-Repeat:
Try to delete a non-exist key and get -1 instead of 1 using dbm_delete.
>Fix:
have dbm_delete in lib/libc/db/ndbm.c return status instead of the if switch.  The original db delete function returns the SAME status codes as dbm_delete according to the man page for db.    
>Release-Note:
>Audit-Trail:

From: GB Clark <gclarkii@vsservices.com>
To: freebsd-gnats-submit@FreeBSD.org, gclarkii@vsservices.com
Cc:  
Subject: Re: misc/42422: dbm_delete returns -1 instead of 1 when the key does
 not exist in the database.
Date: Thu, 09 Jan 2003 01:32:27 -0600

 This is a multi-part message in MIME format.
 --------------040006030405000703060802
 Content-Type: text/plain; charset=us-ascii; format=flowed
 Content-Transfer-Encoding: 7bit
 
 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?
 
 --------------040006030405000703060802
 Content-Type: text/plain;
  name="db.patch.2.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="db.patch.2.txt"
 
 *** ndbm.c	Wed Sep  4 17:14:44 2002
 --- ndbm.c.patched	Wed Sep  4 17:15:06 2002
 ***************
 *** 171,181 ****
   
   	dbtkey.data = key.dptr;
   	dbtkey.size = key.dsize;
 ! 	status = (db->del)(db, &dbtkey, 0);
 ! 	if (status)
 ! 		return (-1);
 ! 	else
 ! 		return (0);
   }
   
   /*
 --- 171,178 ----
   
   	dbtkey.data = key.dptr;
   	dbtkey.size = key.dsize;
 ! 	return (db->del)(db, &dbtkey, 0);
 ! 
   }
   
   /*
 
 --------------040006030405000703060802--
 
>Unformatted:
