When extracting properties, don't bail for non-existent or invalid path

elements, but continue with next properry.
This commit is contained in:
mlelstv 2022-08-21 07:51:30 +00:00
parent 1da4c46ed0
commit 657333c966
1 changed files with 8 additions and 5 deletions

View File

@ -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;
}
}