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

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