From: Yu Watanabe Date: Fri, 2 Sep 2022 15:40:23 +0000 (+0900) Subject: loop-util: always set LoopDevice.node X-Git-Tag: v252-rc1~271^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=062d511776943c26f6952ccfabc4e9f9f8e5a58d;p=thirdparty%2Fsystemd.git loop-util: always set LoopDevice.node --- diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c index 440a196eb33..568e431655f 100644 --- a/src/shared/loop-util.c +++ b/src/shared/loop-util.c @@ -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)) {