]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lostup: report EACCES on loop-control
authorKarel Zak <kzak@redhat.com>
Tue, 21 Oct 2025 08:58:36 +0000 (10:58 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 21 Oct 2025 09:17:47 +0000 (11:17 +0200)
Don't start scanning /dev/loop* after a failed access to
/dev/loop-control. It's a waste of time, and the user does not receive
a relevant error message.

Signed-off-by: Karel Zak <kzak@redhat.com>
lib/loopdev.c

index 7ba425e7cd17c39a69f76c92ac2baf5deb9b97c9..389cb100ee2e33f6f595cb56e787663fac0ff680 100644 (file)
@@ -1747,7 +1747,7 @@ int loopcxt_find_unused(struct loopdev_cxt *lc)
                DBG(CXT, ul_debugobj(lc, "find_unused by loop-control [rc=%d]", rc));
        }
 
-       if (rc < 0) {
+       if (rc < 0 && rc != -EACCES) {
                DBG(CXT, ul_debugobj(lc, "using loop scan"));
                rc = loopcxt_init_iterator(lc, LOOPITER_FL_FREE);
                if (rc)