From owner-freebsd-current@FreeBSD.ORG Tue Aug 30 15:45:23 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 496A3106564A; Tue, 30 Aug 2011 15:45:23 +0000 (UTC) (envelope-from aboyer@averesystems.com) Received: from zimbra.averesystems.com (75-149-8-245-Pennsylvania.hfc.comcastbusiness.net [75.149.8.245]) by mx1.freebsd.org (Postfix) with ESMTP id 168628FC17; Tue, 30 Aug 2011 15:45:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.averesystems.com (Postfix) with ESMTP id 99F4E446002; Tue, 30 Aug 2011 11:47:38 -0400 (EDT) X-Virus-Scanned: amavisd-new at averesystems.com Received: from zimbra.averesystems.com ([127.0.0.1]) by localhost (zimbra.averesystems.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yOXFHxQOow+C; Tue, 30 Aug 2011 11:47:35 -0400 (EDT) Received: from riven.arriad.com (fw.arriad.com [10.0.0.16]) by zimbra.averesystems.com (Postfix) with ESMTPSA id 1B9EB446001; Tue, 30 Aug 2011 11:47:35 -0400 (EDT) From: Andrew Boyer Content-Type: multipart/mixed; boundary=Apple-Mail-12--743014071 Date: Tue, 30 Aug 2011 11:45:18 -0400 Message-Id: To: freebsd-current@freebsd.org Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) Cc: John Baldwin Subject: [patch] Improved error output from sysctl X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2011 15:45:23 -0000 --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--