dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

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

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