Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
nvme-cli.9458
0015-Log-error-incase-of-failure-in-get_nvme_su...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0015-Log-error-incase-of-failure-in-get_nvme_subsystem_in.patch of Package nvme-cli.9458
From 921ab158398227a9a86eb25718548e0427ab086b Mon Sep 17 00:00:00 2001 From: Vijay Kumar <vijay.ac.kumar@oracle.com> Date: Tue, 6 Mar 2018 18:24:12 -0700 Subject: [PATCH] Log error incase of failure in get_nvme_subsystem_info() Currently get_nvme_subsystem_info() silently fails in case of error. This patch logs relevant error message incase of failure in get_nvme_subsystem_info(). Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com> --- nvme.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/nvme.c b/nvme.c index edcdf2d..5018f57 100644 --- a/nvme.c +++ b/nvme.c @@ -1100,18 +1100,24 @@ int get_nvme_subsystem_info(char *name, char *path, int n, i, ret = 1; item->subsysnqn = get_nvme_subsnqn(path); - if (!item->subsysnqn) + if (!item->subsysnqn) { + fprintf(stderr, "failed to get subsystem nqn.\n"); return ret; + } item->name = strdup(name); n = scandir(path, &ctrls, scan_ctrls_filter, alphasort); - if (n < 0) + if (n < 0) { + fprintf(stderr, "failed to scan controller(s).\n"); return ret; + } item->ctrls = calloc(n, sizeof(struct ctrl_list_item)); - if (!item->ctrls) + if (!item->ctrls) { + fprintf(stderr, "failed to allocate subsystem controller(s)\n"); goto free_ctrls; + } item->nctrls = n; @@ -1122,12 +1128,16 @@ int get_nvme_subsystem_info(char *name, char *path, item->ctrls[i].name); item->ctrls[i].address = get_nvme_ctrl_address(ctrl_path); - if (!item->ctrls[i].address) + if (!item->ctrls[i].address) { + fprintf(stderr, "failed to get controller[%d] address.\n", i); goto free_ctrls; + } item->ctrls[i].transport = get_nvme_ctrl_transport(ctrl_path); - if (!item->ctrls[i].transport) + if (!item->ctrls[i].transport) { + fprintf(stderr, "failed to get controller[%d] transport.\n", i); goto free_ctrls; + } } ret = 0; -- 2.13.7
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