Blame SOURCES/0002-losetup-keep-f-and-devname-mutually-exclusive.patch

fe1ca8
From 315960fa9a89248e9d56682c1915567d38fef431 Mon Sep 17 00:00:00 2001
fe1ca8
From: Karel Zak <kzak@redhat.com>
fe1ca8
Date: Thu, 7 Jun 2018 12:05:08 +0200
fe1ca8
Subject: [PATCH 2/6] losetup: keep -f and <devname> mutually exclusive
fe1ca8
fe1ca8
losetup tries to blindly use specified device as well as search for
fe1ca8
the first free device, the result is:
fe1ca8
fe1ca8
 # losetup /dev/loop1 -f /tmp/tfile_loop1
fe1ca8
 losetup: /dev/loop1: failed to set up loop device: Invalid argument
fe1ca8
fe1ca8
fixed version:
fe1ca8
fe1ca8
 # losetup /dev/loop10 -f img
fe1ca8
 losetup: unexpected arguments
fe1ca8
fe1ca8
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1614364
fe1ca8
Upstream: http://github.com/karelzak/util-linux/commit/c3f5a0f1d47dbc47f6d21da232d4eb1cfb7905db
fe1ca8
Signed-off-by: Karel Zak <kzak@redhat.com>
fe1ca8
---
fe1ca8
 sys-utils/losetup.c | 3 +++
fe1ca8
 1 file changed, 3 insertions(+)
fe1ca8
fe1ca8
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
fe1ca8
index 9c479c02d..e80ceacce 100644
fe1ca8
--- a/sys-utils/losetup.c
fe1ca8
+++ b/sys-utils/losetup.c
fe1ca8
@@ -749,6 +749,9 @@ int main(int argc, char **argv)
fe1ca8
 		 */
fe1ca8
 		act = A_CREATE;
fe1ca8
 		file = argv[optind++];
fe1ca8
+
fe1ca8
+		if (optind < argc)
fe1ca8
+			errx(EXIT_FAILURE, _("unexpected arguments"));
fe1ca8
 	}
fe1ca8
 
fe1ca8
 	if (list && !act && optind == argc)
fe1ca8
-- 
fe1ca8
2.14.4
fe1ca8