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

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