summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-04 18:49:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-04 18:49:31 +0000
commitc945f58d0b75d4bfbe966aa8285cc37578ddeeaa (patch)
tree183aa8d75eb59397f560a4bf44d50a0c37d2bbd5 /sbin
parentdb728ac8d9c0997cd0d1fd9b6d51f87047839f44 (diff)
dmesg has two modes. The normal sysctl mode, and the -M/-N kvm searcher.
In both cases once the relevant setup is done, it can drop to tame "stdio".
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dmesg/dmesg.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c
index 53455ec3318..28c83f56c8d 100644
--- a/sbin/dmesg/dmesg.c
+++ b/sbin/dmesg/dmesg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dmesg.c,v 1.25 2015/01/16 06:39:57 deraadt Exp $ */
+/* $OpenBSD: dmesg.c,v 1.26 2015/10/04 18:49:30 deraadt Exp $ */
/* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */
/*-
@@ -108,6 +108,9 @@ main(int argc, char *argv[])
if (sysctl(mib, 2, bufdata, &len, NULL, 0))
err(1, "sysctl: KERN_MSGBUF");
+ if (tame("stdio", NULL) == -1)
+ err(1, "tame");
+
memcpy(&cur, bufdata, sizeof(cur));
bufdata = ((struct msgbuf *)bufdata)->msg_bufc;
} else {
@@ -120,6 +123,9 @@ main(int argc, char *argv[])
"dmesg")) == NULL)
return (1);
+ if (tame("stdio", NULL) == -1)
+ err(1, "tame");
+
if (kvm_nlist(kd, nl) == -1)
errx(1, "kvm_nlist: %s", kvm_geterr(kd));
if (nl[X_MSGBUF].n_type == 0)