The branch main has been updated by ume:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=006a01374f59b839ca1c900efd274a3b92044b15

commit 006a01374f59b839ca1c900efd274a3b92044b15
Author:     Hajimu UMEMOTO <u...@freebsd.org>
AuthorDate: 2021-03-08 03:03:32 +0000
Commit:     Hajimu UMEMOTO <u...@freebsd.org>
CommitDate: 2021-03-08 03:03:32 +0000

    Simplify using nvlist_append_string_array().
    
    Reported by:    hrs
    MFC after:      1 week
---
 usr.sbin/rtsold/rtsold.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c
index 5e5298bfdadc..c1594ec7420a 100644
--- a/usr.sbin/rtsold/rtsold.c
+++ b/usr.sbin/rtsold/rtsold.c
@@ -333,10 +333,8 @@ init_capabilities(void)
 #ifdef WITH_CASPER
        const char *const scripts[] =
            { resolvconf_script, managedconf_script, otherconf_script };
-       const char *scripts_set[nitems(scripts)];
        cap_channel_t *capcasper;
        nvlist_t *limits;
-       int count;
 
        capcasper = cap_init();
        if (capcasper == NULL)
@@ -349,12 +347,11 @@ init_capabilities(void)
        capscript = cap_service_open(capcasper, "rtsold.script");
        if (capscript == NULL)
                return (-1);
-       count = 0;
+       limits = nvlist_create(0);
        for (size_t i = 0; i < nitems(scripts); i++)
                if (scripts[i] != NULL)
-                       scripts_set[count++] = scripts[i];
-       limits = nvlist_create(0);
-       nvlist_add_string_array(limits, "scripts", scripts_set, count);
+                       nvlist_append_string_array(limits, "scripts",
+                           scripts[i]);
        if (cap_limit_set(capscript, limits) != 0)
                return (-1);
 
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to