Date: Tue, 30 Aug 2011 11:45:18 -0400 From: Andrew Boyer <aboyer@averesystems.com> To: freebsd-current@freebsd.org Cc: John Baldwin <jhb@FreeBSD.org> Subject: [patch] Improved error output from sysctl Message-ID: <BF7139BE-70C5-4CAF-A005-06FE04F4F246@averesystems.com>
index | next in thread | raw e-mail
[-- Attachment #1 --]
If malloc() fails in /sbin/sysctl, the error message is unhelpful. This patch helps identify which sysctl entry is failing.
[-- Attachment #2 --]
Index: sbin/sysctl/sysctl.c
===================================================================
--- sbin/sysctl/sysctl.c (revision 225262)
+++ sbin/sysctl/sysctl.c (working copy)
@@ -580,7 +580,7 @@
val = oval = malloc(j + 1);
if (val == NULL) {
- warnx("malloc failed");
+ warnx("%s%s malloc failed %d %d", name, sep, j + 1, errno);
return (1);
}
len = j;
[-- Attachment #3 --]
-Andrew
--------------------------------------------------
Andrew Boyer aboyer@averesystems.com
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BF7139BE-70C5-4CAF-A005-06FE04F4F246>
