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

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