PPR/29909: Manuel Bouyer: sysctl dumps core if kern.consdev returns unknown

device.  If we cannot determine the device name of the console, print the
console dev_t in hex.
This commit is contained in:
christos 2005-04-06 21:13:03 +00:00
parent 4b058b80fb
commit ad6c31cee3
2 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.16 2004/03/25 19:36:27 atatat Exp $
# $NetBSD: Makefile,v 1.17 2005/04/06 21:13:03 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 6/6/93
.include <bsd.own.mk>
CFLAGS+=-g
PROG= sysctl
MAN= sysctl.8

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctl.c,v 1.101 2005/03/28 04:03:13 christos Exp $ */
/* $NetBSD: sysctl.c,v 1.102 2005/04/06 21:13:03 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -72,7 +72,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: sysctl.c,v 1.101 2005/03/28 04:03:13 christos Exp $");
__RCSID("$NetBSD: sysctl.c,v 1.102 2005/04/06 21:13:03 christos Exp $");
#endif
#endif /* not lint */
@ -2079,8 +2079,8 @@ kern_consdev(HANDLER_ARGS)
else {
if (!nflag)
printf("%s%s", sname, eq);
if (nflag < 2)
printf("%s\n", devname(cons, S_IFCHR));
if (nflag < 2 && (sname = devname(cons, S_IFCHR)) != NULL)
printf("%s\n", sname);
else
printf("0x%x\n", cons);
}