Only set O_RDWR for open() when readonly isn't set