summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Cosgrove <tom@cvs.openbsd.org>2017-08-26 08:53:21 +0000
committerTom Cosgrove <tom@cvs.openbsd.org>2017-08-26 08:53:21 +0000
commitf035950a45ae6ec2d027a5c22557377b16c194dd (patch)
tree26e900e08bd1a0f18662546a686f48aa3b626582
parenta54b0c2a2926d47a106e871fb4f2d5dde641a2aa (diff)
Be more precise in the messages given by err() after calling sysctl()
in dmesg.c. Based on a diff from xiao_nan (at) dsi (dot) a-star (dot) edu (dot) sg - thanks. ok otto@
-rw-r--r--sbin/dmesg/dmesg.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c
index 6eb68d32930..e11dd6a7f50 100644
--- a/sbin/dmesg/dmesg.c
+++ b/sbin/dmesg/dmesg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dmesg.c,v 1.27 2015/10/09 01:37:06 deraadt Exp $ */
+/* $OpenBSD: dmesg.c,v 1.28 2017/08/26 08:53:20 tom Exp $ */
/* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */
/*-
@@ -96,7 +96,8 @@ main(int argc, char *argv[])
mib[1] = startupmsgs ? KERN_CONSBUFSIZE : KERN_MSGBUFSIZE;
len = sizeof(msgbufsize);
if (sysctl(mib, 2, &msgbufsize, &len, NULL, 0))
- err(1, "sysctl: KERN_MSGBUFSIZE");
+ err(1, "sysctl: %s", startupmsgs ? "KERN_CONSBUFSIZE" :
+ "KERN_MSGBUFSIZE");
msgbufsize += sizeof(struct msgbuf) - 1;
bufdata = calloc(1, msgbufsize);
@@ -106,7 +107,8 @@ main(int argc, char *argv[])
mib[1] = startupmsgs ? KERN_CONSBUF : KERN_MSGBUF;
len = msgbufsize;
if (sysctl(mib, 2, bufdata, &len, NULL, 0))
- err(1, "sysctl: KERN_MSGBUF");
+ err(1, "sysctl: %s",
+ startupmsgs ? "KERN_CONSBUF" : "KERN_MSGBUF");
if (pledge("stdio", NULL) == -1)
err(1, "pledge");