Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
nvme-cli.27116
0014-nvme-print-Handle-NULL-hostid-in-JSON-outp...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0014-nvme-print-Handle-NULL-hostid-in-JSON-output.patch of Package nvme-cli.27116
From: Tomas Bzatek <tbzatek@redhat.com> Date: Tue, 13 Sep 2022 16:54:44 +0200 Subject: nvme-print: Handle NULL hostid in JSON output Git-commit: cc07ea605d1e89eea98ace6b16e8fd3305a6ee6d References: git-fixes For pcie devices there might be no hostid available, in case the /etc/nvme/hostid file doesn't exist. Acked-by: Daniel Wagner <dwagner@suse.de> --- nvme-print.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/nvme-print.c +++ b/nvme-print.c @@ -2501,12 +2501,14 @@ static void json_print_nvme_subsystem_li nvme_for_each_host(r, h) { nvme_subsystem_t s; + const char *hostid; host_attrs = json_create_object(); json_object_add_value_string(host_attrs, "HostNQN", nvme_host_get_hostnqn(h)); - json_object_add_value_string(host_attrs, "HostID", - nvme_host_get_hostid(h)); + hostid = nvme_host_get_hostid(h); + if (hostid) + json_object_add_value_string(host_attrs, "HostID", hostid); subsystems = json_create_array(); nvme_for_each_subsystem(h, s) { subsystem_attrs = json_create_object(); @@ -7327,9 +7329,12 @@ static void json_detail_list(nvme_root_t nvme_for_each_host(r, h) { struct json_object *hss = json_create_object(); struct json_object *jsslist = json_create_array(); + const char *hostid; json_object_add_value_string(hss, "HostNQN", nvme_host_get_hostnqn(h)); - json_object_add_value_string(hss, "HostID", nvme_host_get_hostid(h)); + hostid = nvme_host_get_hostid(h); + if (hostid) + json_object_add_value_string(hss, "HostID", hostid); nvme_for_each_subsystem(h , s) { struct json_object *jss = json_create_object();
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor