Our nbd devices end up in /dev/block/nbd*. check_conn() tries to
derive the path to the pid file under /sys/block/<nbd device>/pid by
stripping a leading /dev/ path prefix. In our case it ends up with
/sys/block/block/<nbd device>/pid and is unable to locate the pid file.
The attached patch nbd-client-devname.patch uses
if( (p=strrchr(devname, '/')) ) {
devname=p+1;
}
to derive the name of the device.
int fd;
int len;
- if(!strncmp(devname, "/dev/", 5)) {
- devname+=5;
+ if( (p=strrchr(devname, '/')) ) {
+ devname=p+1;
}
if((p=strchr(devname, 'p'))) {
/* We can't do checks on partitions. */