]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
losetup: add error feedback for --remove command
authorKarel Zak <kzak@redhat.com>
Thu, 16 Oct 2025 09:22:47 +0000 (11:22 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 21 Oct 2025 08:47:27 +0000 (10:47 +0200)
The remove_loop() function was silently failing without providing
any feedback to the user. This also fixes incorrect indentation
(spaces instead of tabs).

Signed-off-by: Karel Zak <kzak@redhat.com>
Reported-by: Benno Schulenberg <bensberg@telfort.nl>
sys-utils/losetup.c

index faab3934be16a903a5719c97ddc2b96e6b7d7368..d694190be397c35f1efdb36de8f1597bbb90ebec 100644 (file)
@@ -262,9 +262,11 @@ static int detach_all_loops(struct loopdev_cxt *lc)
 
 static int remove_loop(struct loopdev_cxt *lc)
 {
-    if (loopcxt_remove_device(lc))
-        return -1;
-    return 0;
+       if (loopcxt_remove_device(lc)) {
+               warn(_("%s: remove failed"), loopcxt_get_device(lc));
+               return -1;
+       }
+       return 0;
 }
 
 static int set_scols_data(struct loopdev_cxt *lc, struct libscols_line *ln)