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

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