diff options
author | millert <millert@openbsd.org> | 1998-08-19 06:47:52 +0000 |
---|---|---|
committer | millert <millert@openbsd.org> | 1998-08-19 06:47:52 +0000 |
commit | c59ab75f504d574eaa28aa8004e929a4fbc8fa7b (patch) | |
tree | ae124e14288a6b0d41558f6de29c2e09ca4807ef /usr.sbin/kvm_mkdb/testdb.c | |
parent | Don't segfault in small windows (diff) | |
download | wireguard-openbsd-c59ab75f504d574eaa28aa8004e929a4fbc8fa7b.tar.xz wireguard-openbsd-c59ab75f504d574eaa28aa8004e929a4fbc8fa7b.zip |
Make kvm_mkdb work again
o testdb() needs to take as an arg the name of the kernel so it can do
the version test correctly.
o add undocumented verbose flag to tell when we are rebuilding the .db file
o DO_* -> _NLIST_DO_*, this prevented kvm_mkdb from doing anything at all.
o preserve a few error messages so you get error output when none of
the exec types match the target.
o check malloc return values
o get_kerntext should not subtract the sizeof(struct exec) from kernel_text
Diffstat (limited to 'usr.sbin/kvm_mkdb/testdb.c')
-rw-r--r-- | usr.sbin/kvm_mkdb/testdb.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.sbin/kvm_mkdb/testdb.c b/usr.sbin/kvm_mkdb/testdb.c index 090ed911731..6b5cd804f81 100644 --- a/usr.sbin/kvm_mkdb/testdb.c +++ b/usr.sbin/kvm_mkdb/testdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: testdb.c,v 1.2 1997/01/15 22:08:17 millert Exp $ */ +/* $OpenBSD: testdb.c,v 1.3 1998/08/19 06:47:55 millert Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "from: @(#)testdb.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: testdb.c,v 1.2 1997/01/15 22:08:17 millert Exp $"; +static char *rcsid = "$OpenBSD: testdb.c,v 1.3 1998/08/19 06:47:55 millert Exp $"; #endif #endif /* not lint */ @@ -56,14 +56,14 @@ static char *rcsid = "$OpenBSD: testdb.c,v 1.2 1997/01/15 22:08:17 millert Exp $ /* Return true if the db file is valid, else false */ int -testdb() +testdb(dbname) + char *dbname; { register DB *db; register int cc, kd, ret, dbversionlen; - register char *cp, *uf; DBT rec; struct nlist nitem; - char dbname[MAXPATHLEN], dbversion[_POSIX2_LINE_MAX]; + char dbversion[_POSIX2_LINE_MAX]; char kversion[_POSIX2_LINE_MAX]; ret = 0; @@ -72,10 +72,6 @@ testdb() if ((kd = open(_PATH_KMEM, O_RDONLY, 0)) < 0) goto close; - uf = _PATH_UNIX; - if ((cp = strrchr(uf, '/')) != 0) - uf = cp + 1; - (void)snprintf(dbname, sizeof(dbname), "%skvm_%s.db", _PATH_VARDB, uf); if ((db = dbopen(dbname, O_RDONLY, 0, DB_HASH, NULL)) == NULL) goto close; |