]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loop-util: always set LoopDevice.node
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 2 Sep 2022 15:40:23 +0000 (00:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 2 Sep 2022 15:42:31 +0000 (00:42 +0900)
src/shared/loop-util.c

index 440a196eb33212179e8db0a94631bf5a53d3efc1..568e431655fa74c9f4bb4e133828ff0a43b64867 100644 (file)
@@ -392,6 +392,11 @@ static int loop_device_make_internal(
 
                         if (asprintf(&node, "/dev/loop%i", nr) < 0)
                                 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)) {