]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loop-util: fix error condition and return value
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Feb 2023 06:35:41 +0000 (15:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Feb 2023 20:20:53 +0000 (05:20 +0900)
Fixes a bug introduced by da4fd28871227d23d4719e30da03af5a71f47e5a.

src/shared/loop-util.c

index 5945ba2ad459638748f15b5e6fa49c5bc98a6524..049ec21ab9465d2955e8fefee275e4dcbcb4d09d 100644 (file)
@@ -577,8 +577,8 @@ static int loop_device_make_internal(
                  * device, and called LOOP_CTL_REMOVE on it. Let's retry with a new number.
                  * -EBUSY: a file descriptor is already bound to the loopback block device.
                  * -EUCLEAN: some left-over partition devices that were cleaned up. */
-                if (!ERRNO_IS_DEVICE_ABSENT(errno) && !IN_SET(r, -EBUSY, -EUCLEAN))
-                        return -errno;
+                if (!ERRNO_IS_DEVICE_ABSENT(r) && !IN_SET(r, -EBUSY, -EUCLEAN))
+                        return r;
 
                 /* OK, this didn't work, let's try again a bit later, but first release the lock on the
                  * control device */