Date: Fri, 11 Apr 2025 14:04:04 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 30020689fb1e - main - ctld: Do not remove item from an nvlist while iterating it Message-ID: <202504111404.53BE44n6053836@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=30020689fb1e5c9549e430bd23600c88e1257697 commit 30020689fb1e5c9549e430bd23600c88e1257697 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2025-04-11 14:02:48 +0000 Commit: John Baldwin <jhb@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 "
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504111404.53BE44n6053836>