Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Maintenance:10307
nvme-cli.openSUSE_Leap_42.3_Update
0011-fabrics-Fix-disconnect_by_device-from-disc...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0011-fabrics-Fix-disconnect_by_device-from-disconnecting-.patch of Package nvme-cli.openSUSE_Leap_42.3_Update
From 9b65751fc29c87916b652728eac8c10f2e1212f8 Mon Sep 17 00:00:00 2001 From: Logan Gunthorpe <logang@deltatee.com> Date: Tue, 28 Mar 2017 13:26:41 -0600 Subject: fabrics: Fix disconnect_by_device from disconnecting instance 0 on error Git-commit: 41e3e96c12a138eddfe41f1db4deb57044bd4307 References: bsc#1058538 I was a bit surprised that running: nvme disconnect -d /dev/nvme1 actually disconnected nvme0 and I could never disconnect nvme1. Turns out the code was not expecting a full path and silently used instance zero if it failed to parse any arguments. This patch fixes it so that it ignores any path component and fails if sscanf doesn't match any items. --- fabrics.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fabrics.c b/fabrics.c index b4eaba8..7cf5f46 100644 --- a/fabrics.c +++ b/fabrics.c @@ -31,6 +31,7 @@ #include <asm/byteorder.h> #include <inttypes.h> #include <linux/types.h> +#include <libgen.h> #include "parser.h" #include "nvme-ioctl.h" @@ -968,9 +969,12 @@ static int disconnect_by_device(char *device) int instance; int ret; + device = basename(device); ret = sscanf(device, "nvme%d", &instance); if (ret < 0) return ret; + if (!ret) + return -1; return remove_ctrl(instance); } -- 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