From owner-freebsd-bugs Fri Dec 1 13:31:20 1995 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id NAA25858 for bugs-outgoing; Fri, 1 Dec 1995 13:31:20 -0800 Received: from mv.mv.com (lopez@mv.MV.COM [192.80.84.1]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id NAA25850 for ; Fri, 1 Dec 1995 13:31:17 -0800 Received: (lopez@localhost) by mv.mv.com (8.7.1/mem-940616) id QAA25902 for bugs@freebsd.org; Fri, 1 Dec 1995 16:31:15 -0500 (EST) Date: Fri, 1 Dec 1995 16:31:15 -0500 (EST) From: Lawrence Lopez Message-Id: <199512012131.QAA25902@mv.mv.com> To: bugs@freebsd.org Subject: yellow pages bugs Sender: owner-bugs@freebsd.org Precedence: bulk Fri Dec 1 16:22:11 EST 1995 off of gatekeeper.dec.com: yp_mkdb Reliability issue. FreeBSD 2.0.5 from walnut creek and current mirror at ftp://gatekeeper.dec.com //pub/BSD/FreeBSD/FreeBSD-current /src/gnu/usr.sbin/yp_mkdb/yp_mkdb.c /usr/src/gnu/usr.sbin/yp_mkdb/yp_mkdb.c It looks like it is attempting to create a new data base file in a temporary file. It then removes the old file and rename the temporary file. In fact it does no such thing! In fact it actually loads the new information on top of the old file. It is not clear whether active users of a data base file care (this depends on how good 'hash' of db is.) The code: sprintf(filename, "%s~.db", DbName); if ((dp = dbopen(DbName,O_RDWR|O_EXCL|O_CREAT, PERM_SECURE, DB_HASH, &openinfo)) == NULL) { perror("dbopen"); fprintf(stderr, "%s: Cannot open\n", filename); exit(1); } should have 'DbName' replaced with filename. I think '%s~.db' should be '%s~' The code: sprintf(filename, "%s.db", DbName); sprintf(filename2, "%s~.db", DbName); unlink(filename); rename(filename2, filename); should have the '.db' removed. all return codes should be checked. In fact both the unlink and rename fail.