From 657333c9665dd07c5c0e52c830e820da6e710045 Mon Sep 17 00:00:00 2001 From: mlelstv Date: Sun, 21 Aug 2022 07:51:30 +0000 Subject: [PATCH] When extracting properties, don't bail for non-existent or invalid path elements, but continue with next properry. --- sbin/drvctl/drvctl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sbin/drvctl/drvctl.c b/sbin/drvctl/drvctl.c index ea666f74d6db..9267e1fcc5f8 100644 --- a/sbin/drvctl/drvctl.c +++ b/sbin/drvctl/drvctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: drvctl.c,v 1.21 2020/06/11 13:49:57 thorpej Exp $ */ +/* $NetBSD: drvctl.c,v 1.22 2022/08/21 07:51:30 mlelstv Exp $ */ /* * Copyright (c) 2004 @@ -230,17 +230,20 @@ extract_property(prop_dictionary_t dict, const char *prop, bool nflag) case PROP_TYPE_DICTIONARY: obj = prop_dictionary_get(obj, cur); if (obj == NULL) - exit(EXIT_FAILURE); + p = NULL; break; case PROP_TYPE_ARRAY: ind = strtoul(cur, NULL, 0); obj = prop_array_get(obj, ind); if (obj == NULL) - exit(EXIT_FAILURE); + p = NULL; break; default: - errx(EXIT_FAILURE, "Select neither dict nor array with" - " `%s'", cur); + fprintf(stderr, "Select neither dict nor array with" + " `%s'\n", cur); + obj = NULL; + p = NULL; + break; } }