Source-Changes-HG archive

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

[src/trunk]: src/sbin/drvctl When extracting properties, don't bail for non-e...



details:   https://anonhg.NetBSD.org/src/rev/d19ed6bd19e5
branches:  trunk
changeset: 369544:d19ed6bd19e5
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Aug 21 07:51:30 2022 +0000

description:
When extracting properties, don't bail for non-existent or invalid path
elements, but continue with next properry.

diffstat:

 sbin/drvctl/drvctl.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 5c9cec79f9f7 -r d19ed6bd19e5 sbin/drvctl/drvctl.c
--- a/sbin/drvctl/drvctl.c      Sun Aug 21 07:46:52 2022 +0000
+++ b/sbin/drvctl/drvctl.c      Sun Aug 21 07:51:30 2022 +0000
@@ -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 @@
                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;
                }
        }
 



Home | Main Index | Thread Index | Old Index