]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loop-util: fix error handling
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 15 Feb 2024 15:16:00 +0000 (00:16 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 15 Feb 2024 15:25:37 +0000 (00:25 +0900)
Follow-up for 972c8db589f1f031d1fbbe01d821ddb1795fe285.

src/shared/loop-util.c

index c6dfff43197f0b85c7eb3bbca67d14a37edc83f3..15812717b1b5a4c653f8b8f3193747099ff4f54c 100644 (file)
@@ -679,7 +679,7 @@ int loop_device_make_by_path_at(
         else
                 direct = direct_flags != 0;
         if (fd < 0) {
-                r = -errno;
+                r = fd;
 
                 /* Retry read-only? */
                 if (open_flags >= 0 || !(ERRNO_IS_PRIVILEGE(r) || r == -EROFS))