From owner-freebsd-hackers Sun Oct 27 12:22:37 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4808137B401 for ; Sun, 27 Oct 2002 12:22:35 -0800 (PST) Received: from primus.vsservices.com (primus.vsservices.com [63.66.136.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id C49A843E77 for ; Sun, 27 Oct 2002 12:22:34 -0800 (PST) (envelope-from gclarkii@vsservices.com) Received: from prime.vsservices.com (conr-adsl-dhcp-26-247.txucom.net [209.34.26.247]) by primus.vsservices.com (8.12.6/8.12.5) with SMTP id g9RKMX30096015 for ; Sun, 27 Oct 2002 14:22:34 -0600 (CST) (envelope-from gclarkii@vsservices.com) Date: Sun, 27 Oct 2002 14:21:12 -0600 From: GB Clark To: hackers@freebsd.org Subject: Fw: Anyone got time for a quick fix commit in the libc/db? Patch included Message-Id: <20021027142112.1d774e2c.gclarkii@vsservices.com> X-Mailer: Sylpheed version 0.8.2 (GTK+ 1.2.10; i386-portbld-freebsd4.6) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello, There are two seperate bugs in libc/db. The first is the in libc/db/hash/hash.c in hash_action. If hash_action is called with HASH_DELETE and the key is not found it will return -1 (error) instead of 1 (key not found) as documented in the man page. This bug is mentioned in PR misc/42429. The second is in libc/db/hash/ndbm.c. dbm_delete needs to be changed to return the status from the db call directly. As it stands now it just checks for a non-zero and returns -1 if this is so. If it returned the status directly then it would work as documented. This is the bug mentioned in PR misc/42422. Attached are two patch files relative to lib/libc/db/hash. Should have done more research before I sent the first PR...:) GB -PATCH1- *** hash.c Wed Sep 4 17:13:22 2002 --- hash.c.patched Wed Sep 4 17:11:03 2002 *************** *** 685,692 **** save_bufp->flags &= ~BUF_PIN; return (SUCCESS); } - case HASH_GET: case HASH_DELETE: default: save_bufp->flags &= ~BUF_PIN; return (ABNORMAL); --- 685,693 ---- save_bufp->flags &= ~BUF_PIN; return (SUCCESS); } case HASH_DELETE: + return 1; + case HASH_GET: default: save_bufp->flags &= ~BUF_PIN; return (ABNORMAL); -PATCH2- *** 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); ! } /* -CUT- GB -- GB Clark II | Roaming FreeBSD Admin gclarkii@VSServices.COM | General Geek CTHULU for President - Why choose the lesser of two evils? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message