The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=30020689fb1e5c9549e430bd23600c88e1257697

commit 30020689fb1e5c9549e430bd23600c88e1257697
Author:     John Baldwin <j...@freebsd.org>
AuthorDate: 2025-04-11 14:02:48 +0000
Commit:     John Baldwin <j...@freebsd.org>
CommitDate: 2025-04-11 14:02:48 +0000

    ctld: Do not remove item from an nvlist while iterating it
    
    While here, make use of cnvlist_* to simplify this code.
    
    Fixes:          d42a73fb6a85 ("ctld: Add a dedicated API between parse.y 
and the rest of the program")
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D49650
---
 usr.sbin/ctld/kernel.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/ctld/kernel.cc b/usr.sbin/ctld/kernel.cc
index 9ddf22b9f4e0..0cd0eaff6c6f 100644
--- a/usr.sbin/ctld/kernel.cc
+++ b/usr.sbin/ctld/kernel.cc
@@ -40,6 +40,7 @@
 #include <sys/param.h>
 #include <sys/capsicum.h>
 #include <sys/callout.h>
+#include <sys/cnv.h>
 #include <sys/ioctl.h>
 #include <sys/linker.h>
 #include <sys/module.h>
@@ -635,12 +636,12 @@ retry_port:
                    NULL) {
                        if (strcmp(key, "file") == 0 ||
                            strcmp(key, "dev") == 0) {
-                               cl->l_path = nvlist_take_string(lun->attr_list,
-                                   key);
+                               cl->l_path = checked_strdup(
+                                   cnvlist_get_string(cookie));
                                continue;
                        }
                        nvlist_add_string(cl->l_options, key,
-                           nvlist_get_string(lun->attr_list, key));
+                           cnvlist_get_string(cookie));
                        error = nvlist_error(cl->l_options);
                        if (error != 0)
                                log_warnc(error, "unable to add CTL lun option "

Reply via email to