924a2dabc4
Add 0047-RHBZ-980777-kpartx-read-only-loop-devs.patch * make kpartx support read-only files better Resolves: bz #980777
40 lines
1.2 KiB
Diff
40 lines
1.2 KiB
Diff
---
|
|
kpartx/kpartx.c | 3 +--
|
|
kpartx/lopart.c | 2 +-
|
|
2 files changed, 2 insertions(+), 3 deletions(-)
|
|
|
|
Index: multipath-tools-130222/kpartx/kpartx.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
|
+++ multipath-tools-130222/kpartx/kpartx.c
|
|
@@ -204,7 +204,6 @@ main(int argc, char **argv){
|
|
char * delim = NULL;
|
|
char *uuid = NULL;
|
|
char *mapname = NULL;
|
|
- int loopro = 0;
|
|
int hotplug = 0;
|
|
int loopcreated = 0;
|
|
struct stat buf;
|
|
@@ -315,7 +314,7 @@ main(int argc, char **argv){
|
|
if (!loopdev) {
|
|
loopdev = find_unused_loop_device();
|
|
|
|
- if (set_loop(loopdev, device, 0, &loopro)) {
|
|
+ if (set_loop(loopdev, device, 0, &ro)) {
|
|
fprintf(stderr, "can't set up loop\n");
|
|
exit (1);
|
|
}
|
|
Index: multipath-tools-130222/kpartx/lopart.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/kpartx/lopart.c
|
|
+++ multipath-tools-130222/kpartx/lopart.c
|
|
@@ -230,7 +230,7 @@ set_loop (const char *device, const char
|
|
|
|
if ((ffd = open (file, mode)) < 0) {
|
|
|
|
- if (!*loopro && errno == EROFS)
|
|
+ if (!*loopro && (errno == EROFS || errno == EACCES))
|
|
ffd = open (file, mode = O_RDONLY);
|
|
|
|
if (ffd < 0) {
|