[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ndbm support




On Thu, 4 Jul 1996, Aarnio Matti wrote:

> >   It seems that the owner_ndbm() and modp_ndbm() functions in ndbm.c have 
> > been modified not to use dbm_pagfno() (I believe in 2.99.26) to get the file 
> > descriptor associated with the database, but instead to use stat() calls on
> > the filename.
> >
> >   However, the code appears to assume that the database name will equal 
> > the filename.  This won't work with the original ndbm as separate 
> > <database name>.dir and <database name>.pag files are used.  This 
> > won't work with the BSD db package as the a <database name>.db file is 
> > used.  I guess this will only work with gdbm() as uses only one file, and 
> > no suffix?
> 
> 	Right..  The change was made originally due to that diabolic
> 	new BSD "db"-thing, which claimed to be NDBM, but is not.
> 	Propably I need to add a new mechanism for it alone, and
> 	revert all else into the old state.

  Maybe.  But there is an easy fix to ndbm.c that will make it work on 
ndbm and db systems (and presumably gdbm too).

  Here is is:

256,264c256,257
< #if 1
< 	/* No lstat()! */
< 	if (stat(sip->file, &stbuf) < 0) {
< 		fprintf(stderr, "owner_ndbm: cannot stat(\"%s\")!\n",
< 				sip->file);
< 		return;
< 	}
< #else
< 	if (fstat(dbm_pagfno(db), &stbuf) < 0) {
---
> 
> 	if (fstat(dbm_dirfno(db), &stbuf) < 0) {
269c262
< #endif
---
> 
287,294c280,281
< #if 1
< 	if (stat(sip->file, &stbuf) < 0) {
< 		fprintf(stderr, "modp_ndbm: cannot stat(\"%s\")!\n",
< 				sip->file);
< 		return 0;
< 	}
< #else
< 	if (fstat(dbm_pagfno(db), &stbuf) < 0) {
---
> 
> 	if (fstat(dbm_dirfno(db), &stbuf) < 0) {
299c286
< #endif
---
> 


  BSD db has dbm_dirfno, but no dbm_pagnfo() because db doesn't have a 
.pag file.

  I think that a note should be added to router man page about the "-m" 
relation option, stating that only safe way to update a database is to mv 
the new database over the old one.

  makendbm.c and lookndbm.c also contains a definition of sys_errlist[] 
which stops it from building on most BSD 4.4 systems.

Tom