summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2018-06-07 12:05:08 +0200
committerKarel Zak2018-06-07 12:05:08 +0200
commitc3f5a0f1d47dbc47f6d21da232d4eb1cfb7905db (patch)
tree7d4b9384dc5b5e3d01db4a589b744bf00e1e5898
parentagetty: keep c_iflags unmodified on --autologin (diff)
downloadkernel-qcow2-util-linux-c3f5a0f1d47dbc47f6d21da232d4eb1cfb7905db.tar.gz
kernel-qcow2-util-linux-c3f5a0f1d47dbc47f6d21da232d4eb1cfb7905db.tar.xz
kernel-qcow2-util-linux-c3f5a0f1d47dbc47f6d21da232d4eb1cfb7905db.zip
losetup: keep -f and <devname> mutually exclusive
losetup tries to blindly use specified device as well as search for the first free device, the result is: # losetup /dev/loop1 -f /tmp/tfile_loop1 losetup: /dev/loop1: failed to set up loop device: Invalid argument fixed version: # losetup /dev/loop10 -f img losetup: unexpected arguments Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1566432 Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--sys-utils/losetup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index 670bce2e3..9eecf06a4 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -762,6 +762,9 @@ int main(int argc, char **argv)
*/
act = A_CREATE;
file = argv[optind++];
+
+ if (optind < argc)
+ errx(EXIT_FAILURE, _("unexpected arguments"));
}
if (list && !act && optind == argc)