Date: Fri, 1 Dec 1995 16:31:15 -0500 (EST) From: Lawrence Lopez <lopez@mv.MV.COM> To: bugs@freebsd.org Subject: yellow pages bugs Message-ID: <199512012131.QAA25902@mv.mv.com>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512012131.QAA25902>