]> git.ipfire.org Git - thirdparty/util-linux.git/commit
losetup: improve command line option processing
authorKarel Zak <kzak@redhat.com>
Tue, 21 Oct 2025 09:45:54 +0000 (11:45 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 21 Oct 2025 09:45:54 +0000 (11:45 +0200)
commit787f8251b539ad6c3cd1098ab155980afe611867
tree29b56b5d5f79c91fcd48b6cef98c89bbf25d21a9
parent19cd36ebc2e227b2a93c70207b213da58f7be5e2
losetup: improve command line option processing

The options --detach, --remove, and --set-capacity are mutually
exclusive. We can assume the device name follows the options, which is
better than assuming the device name is specified as an option's
argument. This also allows the use of the existing mutually-exclusive
check.

 # losetup --remove --detach loop0
 losetup: /dev/--detach: remove failed: Success
 losetup: /dev/loop0: remove failed: Device or resource busy

is ugly.

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