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

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