Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/sbin/sysctl Pull up revision 1.59 (requested by simon i...
details: https://anonhg.NetBSD.org/src/rev/3da10c60ff4c
branches: netbsd-1-6
changeset: 529347:3da10c60ff4c
user: lukem <lukem%NetBSD.org@localhost>
date: Fri Nov 15 00:39:49 2002 +0000
description:
Pull up revision 1.59 (requested by simon in ticket #958):
When printing out nodes of type "string", don't print anything if
sysctl() reports that 0 bytes were returned.
Reported by Matt Green with "sysctl hw.disknames" on a system with no
disks.
--
diffstat:
sbin/sysctl/sysctl.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (28 lines):
diff -r d25bfefd8488 -r 3da10c60ff4c sbin/sysctl/sysctl.c
--- a/sbin/sysctl/sysctl.c Fri Nov 15 00:37:43 2002 +0000
+++ b/sbin/sysctl/sysctl.c Fri Nov 15 00:39:49 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysctl.c,v 1.58 2002/03/24 00:11:00 sommerfeld Exp $ */
+/* $NetBSD: sysctl.c,v 1.58.2.1 2002/11/15 00:39:49 lukem Exp $ */
/*
* Copyright (c) 1993
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: sysctl.c,v 1.58 2002/03/24 00:11:00 sommerfeld Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.58.2.1 2002/11/15 00:39:49 lukem Exp $");
#endif
#endif /* not lint */
@@ -661,6 +661,9 @@
return;
case CTLTYPE_STRING:
+ /* If sysctl() didn't return any data, don't print a string. */
+ if (size == 0)
+ buf[0] = '\0';
if (newsize == 0) {
if (!nflag)
printf("%s = ", string);
Home |
Main Index |
Thread Index |
Old Index