Blame SOURCES/0047-RHBZ-kpartx-read-only-loop-devs.patch

38852f
---
38852f
 kpartx/kpartx.c |    3 +--
38852f
 kpartx/lopart.c |    2 +-
38852f
 2 files changed, 2 insertions(+), 3 deletions(-)
38852f
38852f
Index: multipath-tools-130222/kpartx/kpartx.c
38852f
===================================================================
38852f
--- multipath-tools-130222.orig/kpartx/kpartx.c
38852f
+++ multipath-tools-130222/kpartx/kpartx.c
38852f
@@ -204,7 +204,6 @@ main(int argc, char **argv){
38852f
 	char * delim = NULL;
38852f
 	char *uuid = NULL;
38852f
 	char *mapname = NULL;
38852f
-	int loopro = 0;
38852f
 	int hotplug = 0;
38852f
 	int loopcreated = 0;
38852f
 	struct stat buf;
38852f
@@ -315,7 +314,7 @@ main(int argc, char **argv){
38852f
 		if (!loopdev) {
38852f
 			loopdev = find_unused_loop_device();
38852f
 
38852f
-			if (set_loop(loopdev, device, 0, &loopro)) {
38852f
+			if (set_loop(loopdev, device, 0, &ro)) {
38852f
 				fprintf(stderr, "can't set up loop\n");
38852f
 				exit (1);
38852f
 			}
38852f
Index: multipath-tools-130222/kpartx/lopart.c
38852f
===================================================================
38852f
--- multipath-tools-130222.orig/kpartx/lopart.c
38852f
+++ multipath-tools-130222/kpartx/lopart.c
38852f
@@ -230,7 +230,7 @@ set_loop (const char *device, const char
38852f
 
38852f
 	if ((ffd = open (file, mode)) < 0) {
38852f
 
38852f
-		if (!*loopro && errno == EROFS)
38852f
+		if (!*loopro && (errno == EROFS || errno == EACCES))
38852f
 			ffd = open (file, mode = O_RDONLY);
38852f
 
38852f
 		if (ffd < 0) {