loop-util: always set LoopDevice.node

This commit is contained in:
Yu Watanabe 2022-09-03 00:40:23 +09:00
parent 672780cde1
commit 062d511776

View File

@ -392,6 +392,11 @@ static int loop_device_make_internal(
if (asprintf(&node, "/dev/loop%i", nr) < 0) if (asprintf(&node, "/dev/loop%i", nr) < 0)
return -ENOMEM; return -ENOMEM;
} else {
/* This is a non-loopback block device. Let's get the path to the device node. */
r = devname_from_stat_rdev(&st, &node);
if (r < 0)
return r;
} }
if (offset == 0 && IN_SET(size, 0, UINT64_MAX)) { if (offset == 0 && IN_SET(size, 0, UINT64_MAX)) {