mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-16 15:44:04 +01:00
Test the correct database file (not necessarily the one corresponding to
the running kernel if the nlist file is specified explicitly).
This commit is contained in:
parent
429d613afc
commit
9d91b8ad50
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47218
@ -34,5 +34,4 @@
|
||||
*/
|
||||
|
||||
void create_knlist __P((char *, DB *));
|
||||
void error __P((char *));
|
||||
int testdb __P(());
|
||||
int testdb __P((char *));
|
||||
|
@ -42,7 +42,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)kvm_mkdb.c 8.3 (Berkeley) 5/4/95";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
"$Id: kvm_mkdb.c,v 1.7 1997/09/24 06:44:09 charnier Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -92,12 +92,13 @@ main(argc, argv)
|
||||
if (argc > 1)
|
||||
usage();
|
||||
|
||||
nlistpath = argc > 0 ? argv[0] : (char *)getbootfile();
|
||||
|
||||
/* If the existing db file matches the currently running kernel, exit */
|
||||
if (testdb())
|
||||
if (testdb(nlistpath))
|
||||
exit(0);
|
||||
|
||||
#define basename(cp) ((p = rindex((cp), '/')) != NULL ? p + 1 : (cp))
|
||||
nlistpath = argc > 0 ? argv[0] : (char *)getbootfile();
|
||||
nlistname = basename(nlistpath);
|
||||
|
||||
(void)snprintf(dbtemp, sizeof(dbtemp), "%skvm_%s.tmp",
|
||||
|
@ -36,7 +36,7 @@
|
||||
static char sccsid[] = "@(#)testdb.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
"$Id: testdb.c,v 1.3 1997/09/24 06:44:12 charnier Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -54,11 +54,12 @@ static const char rcsid[] =
|
||||
|
||||
/* Return true if the db file is valid, else false */
|
||||
int
|
||||
testdb()
|
||||
testdb(uf)
|
||||
char *uf;
|
||||
{
|
||||
register DB *db;
|
||||
register int cc, kd, ret, dbversionlen;
|
||||
register char *cp, *uf;
|
||||
register char *cp;
|
||||
DBT rec;
|
||||
struct nlist nitem;
|
||||
char dbname[MAXPATHLEN], dbversion[_POSIX2_LINE_MAX];
|
||||
@ -70,7 +71,6 @@ testdb()
|
||||
if ((kd = open(_PATH_KMEM, O_RDONLY, 0)) < 0)
|
||||
goto close;
|
||||
|
||||
uf = (char *)getbootfile();
|
||||
if ((cp = rindex(uf, '/')) != 0)
|
||||
uf = cp + 1;
|
||||
(void) snprintf(dbname, sizeof(dbname), "%skvm_%s.db", _PATH_VARDB, uf);
|
||||
|
Loading…
Reference in New Issue
Block a user