From 51e9d204ec21bfe92fdaf1da10de6839207b44df Mon Sep 17 00:00:00 2001 From: xtraeme Date: Sun, 26 Aug 2007 10:20:33 +0000 Subject: [PATCH] Check if the dictionary is empty and print a message if it's true. --- usr.sbin/envstat/envstat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.sbin/envstat/envstat.c b/usr.sbin/envstat/envstat.c index fd5aae85b62c..a063d5465c7a 100644 --- a/usr.sbin/envstat/envstat.c +++ b/usr.sbin/envstat/envstat.c @@ -1,4 +1,4 @@ -/* $NetBSD: envstat.c,v 1.41 2007/08/05 23:20:44 xtraeme Exp $ */ +/* $NetBSD: envstat.c,v 1.42 2007/08/26 10:20:33 xtraeme Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -528,6 +528,11 @@ parse_dictionary(int fd) if (rval) return rval; + if (prop_dictionary_count(dict) == 0) { + warnx("no drivers registered"); + goto out; + } + if (mydevname) { obj = prop_dictionary_get(dict, mydevname); if (prop_object_type(obj) != PROP_TYPE_ARRAY) {