From owner-svn-src-all@FreeBSD.ORG Sun Jan 15 22:08:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD930106564A; Sun, 15 Jan 2012 22:08:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7BEA8FC0C; Sun, 15 Jan 2012 22:08:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0FM8ieQ002695; Sun, 15 Jan 2012 22:08:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FM8iSj002693; Sun, 15 Jan 2012 22:08:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201201152208.q0FM8iSj002693@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jan 2012 22:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230172 - stable/8/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jan 2012 22:08:45 -0000 Author: avg Date: Sun Jan 15 22:08:44 2012 New Revision: 230172 URL: http://svn.freebsd.org/changeset/base/230172 Log: MFC r228710: opensolaris compat: fix vcmn_err so that panic(9) produces a proper message Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Sun Jan 15 22:07:14 2012 (r230171) +++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Sun Jan 15 22:08:44 2012 (r230172) @@ -28,29 +28,35 @@ void vcmn_err(int ce, const char *fmt, va_list adx) { char buf[256]; + const char *prefix; + prefix = NULL; /* silence unwitty compilers */ switch (ce) { case CE_CONT: - snprintf(buf, sizeof(buf), "Solaris(cont): %s\n", fmt); + prefix = "Solaris(cont): "; break; case CE_NOTE: - snprintf(buf, sizeof(buf), "Solaris: NOTICE: %s\n", fmt); + prefix = "Solaris: NOTICE: "; break; case CE_WARN: - snprintf(buf, sizeof(buf), "Solaris: WARNING: %s\n", fmt); + prefix = "Solaris: WARNING: "; break; case CE_PANIC: - snprintf(buf, sizeof(buf), "Solaris(panic): %s\n", fmt); + prefix = "Solaris(panic): "; break; case CE_IGNORE: break; default: panic("Solaris: unknown severity level"); } - if (ce == CE_PANIC) - panic("%s", buf); - if (ce != CE_IGNORE) - vprintf(buf, adx); + if (ce == CE_PANIC) { + vsnprintf(buf, sizeof(buf), fmt, adx); + panic("%s%s", prefix, buf); + } + if (ce != CE_IGNORE) { + printf("%s", prefix); + vprintf(fmt, adx); + } } void