Fix for device name detection
authorJean Wolter <jean@sec.t-labs.tu-berlin.de>
Wed, 2 May 2012 14:46:34 +0000 (16:46 +0200)
committerWouter Verhelst <w@uter.be>
Wed, 2 May 2012 14:46:34 +0000 (16:46 +0200)
commite26f08221e5a78c9aeeb823cd2a0b8e22e9bdc03
treed1bf40e077b5786b5caea4d3b7cb071ee2545415
parent5bd1679e51b9e3cc4825323ec6c11eab827507c2
Fix for device name detection

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.
nbd-client.c