Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/sysctl PPR/29909: Manuel Bouyer: sysctl dumps core if k...



details:   https://anonhg.NetBSD.org/src/rev/4d0e3b1b9a7a
branches:  trunk
changeset: 580055:4d0e3b1b9a7a
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 06 21:13:03 2005 +0000

description:
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.

diffstat:

 sbin/sysctl/Makefile |  3 ++-
 sbin/sysctl/sysctl.c |  8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r a53d9599ede6 -r 4d0e3b1b9a7a sbin/sysctl/Makefile
--- a/sbin/sysctl/Makefile      Wed Apr 06 21:06:28 2005 +0000
+++ b/sbin/sysctl/Makefile      Wed Apr 06 21:13:03 2005 +0000
@@ -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
diff -r a53d9599ede6 -r 4d0e3b1b9a7a sbin/sysctl/sysctl.c
--- a/sbin/sysctl/sysctl.c      Wed Apr 06 21:06:28 2005 +0000
+++ b/sbin/sysctl/sysctl.c      Wed Apr 06 21:13:03 2005 +0000
@@ -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 @@
 #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 @@
        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);
        }



Home | Main Index | Thread Index | Old Index