summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorNaphtali Sprei <nsprei@redhat.com>2010-01-21 14:40:41 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-26 15:42:01 -0600
commit0a7fc983ceb21ee45a9ad4dbc9163394f8aa0fb6 (patch)
tree704962b57a973bf88efee917e338c86353bd3979
parent058fc8c768f81f9140db511171185dc8e0676163 (diff)
downloadfocaccia-qemu-0a7fc983ceb21ee45a9ad4dbc9163394f8aa0fb6.tar.gz
focaccia-qemu-0a7fc983ceb21ee45a9ad4dbc9163394f8aa0fb6.zip
Read-only device changed to opens it's file for read-only.
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--block/bochs.c6
-rw-r--r--block/parallels.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/block/bochs.c b/block/bochs.c
index 34892582ef..fb83594dba 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -116,11 +116,9 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags)
     struct bochs_header bochs;
     struct bochs_header_v1 header_v1;
 
-    fd = open(filename, O_RDWR | O_BINARY);
+    fd = open(filename, O_RDONLY | O_BINARY);
     if (fd < 0) {
-        fd = open(filename, O_RDONLY | O_BINARY);
-        if (fd < 0)
-            return -1;
+        return -1;
     }
 
     bs->read_only = 1; // no write support yet
diff --git a/block/parallels.c b/block/parallels.c
index 63b67380ad..41b3a7c9db 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -74,11 +74,9 @@ static int parallels_open(BlockDriverState *bs, const char *filename, int flags)
     int fd, i;
     struct parallels_header ph;
 
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
+    fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
     if (fd < 0) {
-        fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
-        if (fd < 0)
-            return -1;
+        return -1;
     }
 
     bs->read_only = 1; // no write support yet