Rename the database after closing it in hpropd
commit965345a9d20c6aea32a365ebbd8e82ecadc68ebc
authorRuss Allbery <rra@stanford.edu>
Tue, 2 Feb 2010 05:27:14 +0000 (1 21:27 -0800)
committerLove Hornquist Astrand <lha@h5l.org>
Tue, 2 Feb 2010 21:42:32 +0000 (2 13:42 -0800)
treed9c9869b53eebf46121c5f454d246612105e263c
parentd2ae7c0db49629beea5e37d9be3824b2a1558cdf
Rename the database after closing it in hpropd

If a Berkeley DB database is used as the underlying database, renaming
the database before closing it can produce error messages like the
following on close:

/var/lib/heimdal-kdc/heimdal~.db: unable to flush: No such file or directory

since the underlying database library caches the old file name.  There
is a rename() method in the Berkeley DB API, but it also invalidates
the database handle and requires that it be reopened.  Since the
hdb_rename implementation does not require that the database be open,
close the database before renaming it to avoid this problem.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
kdc/hpropd.c