summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kvm_mkdb
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-11-05 16:15:47 +0000
committerderaadt <deraadt@openbsd.org>2015-11-05 16:15:47 +0000
commit7a1953db5c956d0c2878238b00023650322bc63d (patch)
tree148b597e659ddddc9459cc102a3276dec00c6ed9 /usr.sbin/kvm_mkdb
parentfor mice with wheels, check for W direction at AC Pan input used in (diff)
downloadwireguard-openbsd-7a1953db5c956d0c2878238b00023650322bc63d.tar.xz
wireguard-openbsd-7a1953db5c956d0c2878238b00023650322bc63d.zip
there is a retry path in here which contains rename() and fchown().
Use a slightly larger pledge, earlier on. from gregor best
Diffstat (limited to 'usr.sbin/kvm_mkdb')
-rw-r--r--usr.sbin/kvm_mkdb/kvm_mkdb.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/kvm_mkdb/kvm_mkdb.c b/usr.sbin/kvm_mkdb/kvm_mkdb.c
index fa4c20393d5..5759f4bb454 100644
--- a/usr.sbin/kvm_mkdb/kvm_mkdb.c
+++ b/usr.sbin/kvm_mkdb/kvm_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_mkdb.c,v 1.24 2015/10/16 13:37:44 millert Exp $ */
+/* $OpenBSD: kvm_mkdb.c,v 1.25 2015/11/05 16:15:47 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -98,6 +98,9 @@ main(int argc, char *argv[])
if (argc > 1)
usage();
+ if (pledge("stdio rpath wpath cpath fattr flock", NULL) == -1)
+ err(1, "pledge");
+
/* If no kernel specified use _PATH_KSYMS and fall back to _PATH_UNIX */
if (argc > 0) {
nlistpath = argv[0];
@@ -169,10 +172,6 @@ kvm_mkdb(int fd, const char *dbdir, char *nlistpath, char *nlistname,
return(1);
}
- /* rename() later */
- if (pledge("stdio rpath wpath cpath flock", NULL) == -1)
- err(1, "pledge");
-
if (create_knlist(nlistpath, fd, db) != 0) {
warn("cannot determine executable type of %s", nlistpath);
(void)unlink(dbtemp);