From f1c57e949bd50b178bb720ba816780275cda469e Mon Sep 17 00:00:00 2001 From: bde Date: Sat, 15 May 1999 11:54:36 +0000 Subject: Test the correct database file (not necessarily the one corresponding to the running kernel if the nlist file is specified explicitly). --- usr.sbin/kvm_mkdb/extern.h | 3 +-- usr.sbin/kvm_mkdb/kvm_mkdb.c | 7 ++++--- usr.sbin/kvm_mkdb/testdb.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'usr.sbin/kvm_mkdb') diff --git a/usr.sbin/kvm_mkdb/extern.h b/usr.sbin/kvm_mkdb/extern.h index 6d72268..fbe8efa 100644 --- a/usr.sbin/kvm_mkdb/extern.h +++ b/usr.sbin/kvm_mkdb/extern.h @@ -34,5 +34,4 @@ */ void create_knlist __P((char *, DB *)); -void error __P((char *)); -int testdb __P(()); +int testdb __P((char *)); diff --git a/usr.sbin/kvm_mkdb/kvm_mkdb.c b/usr.sbin/kvm_mkdb/kvm_mkdb.c index 0284c55..cfec176 100644 --- a/usr.sbin/kvm_mkdb/kvm_mkdb.c +++ b/usr.sbin/kvm_mkdb/kvm_mkdb.c @@ -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 @@ -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", diff --git a/usr.sbin/kvm_mkdb/testdb.c b/usr.sbin/kvm_mkdb/testdb.c index 8d769bd..1a8726a 100644 --- a/usr.sbin/kvm_mkdb/testdb.c +++ b/usr.sbin/kvm_mkdb/testdb.c @@ -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 @@ -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); -- cgit v1.1