Only set O_RDWR for open() when readonly isn't set
[fio.git] / filesetup.c
index 37a34399e03d29d75d432b9c7c2ef62afcb96a07..5c02f1c46408fb0e2f781f1ba15118e710935a4e 100644 (file)
@@ -291,9 +291,8 @@ int generic_open_file(struct thread_data *td, struct fio_file *f)
 
 open_again:
        if (td_write(td)) {
 
 open_again:
        if (td_write(td)) {
-               assert(!read_only);
-
-               flags |= O_RDWR;
+               if (!read_only)
+                       flags |= O_RDWR;
 
                if (f->filetype == FIO_TYPE_FILE)
                        flags |= O_CREAT;
 
                if (f->filetype == FIO_TYPE_FILE)
                        flags |= O_CREAT;