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>
next in thread | raw e-mail | index | archive | help
--Apple-Mail-12--743014071
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
If malloc() fails in /sbin/sysctl, the error message is unhelpful. This =
patch helps identify which sysctl entry is failing.
--Apple-Mail-12--743014071
Content-Disposition: attachment;
filename=sysctl.diff
Content-Type: application/octet-stream;
name="sysctl.diff"
Content-Transfer-Encoding: 7bit
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;
--Apple-Mail-12--743014071
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
-Andrew
--------------------------------------------------
Andrew Boyer aboyer@averesystems.com
--Apple-Mail-12--743014071--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BF7139BE-70C5-4CAF-A005-06FE04F4F246>
