Hi all,

I modify error message in dmesg.c. Patch is attached, apologize if I'm wrong.

Thanks!

Best Regards
Nan Xiao

Index: dmesg.c
===================================================================
RCS file: /cvs/src/sbin/dmesg/dmesg.c,v
retrieving revision 1.27
diff -u -p -r1.27 dmesg.c
--- dmesg.c9 Oct 2015 01:37:06 -00001.27
+++ dmesg.c26 Aug 2017 03:23:55 -0000
@@ -95,8 +95,12 @@ main(int argc, char *argv[])
 mib[0] = CTL_KERN;
 mib[1] = startupmsgs ? KERN_CONSBUFSIZE : KERN_MSGBUFSIZE;
 len = sizeof(msgbufsize);
-if (sysctl(mib, 2, &msgbufsize, &len, NULL, 0))
-err(1, "sysctl: KERN_MSGBUFSIZE");
+if (sysctl(mib, 2, &msgbufsize, &len, NULL, 0)) {
+if (startupmsgs)
+err(1, "sysctl: KERN_CONSBUFSIZE");
+else
+err(1, "sysctl: KERN_MSGBUFSIZE");
+}

 msgbufsize += sizeof(struct msgbuf) - 1;
 bufdata = calloc(1, msgbufsize);
@@ -105,8 +109,12 @@ 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");
+if (sysctl(mib, 2, bufdata, &len, NULL, 0)) {
+if (startupmsgs)
+err(1, "sysctl: KERN_CONSBUF");
+else
+err(1, "sysctl: KERN_MSGBUF");
+}

 if (pledge("stdio", NULL) == -1)
 err(1, "pledge");
This e-mail and any attachments are only for the use of the intended recipient 
and may contain material that is confidential, privileged and/or protected by 
the Official Secrets Act. If you are not the intended recipient, please delete 
it or notify the sender immediately. Please do not copy or use it for any 
purpose or disclose the contents to any other person.

Reply via email to