Don't open directory with O_RDWR
Apparently, a directory cannot be opened with O_RDWR, otherwise open(2)
will return EISDIR. This is also documented in manpage.
Bug: 203251769
Test: no more EISDIR on open(2)
Change-Id: Ibe02bf793c1775475c086ec0122ec42dc902be16
diff --git a/authfs/tests/open_then_run.rs b/authfs/tests/open_then_run.rs
index ba3ed38..a540f9d 100644
--- a/authfs/tests/open_then_run.rs
+++ b/authfs/tests/open_then_run.rs
@@ -118,7 +118,7 @@
})?;
let dir_files = parse_and_create_file_mapping(matches.values_of("open-dir"), |path| {
- Dir::open(path, OFlag::O_DIRECTORY | OFlag::O_RDWR, Mode::S_IRWXU)
+ Dir::open(path, OFlag::O_DIRECTORY | OFlag::O_RDONLY, Mode::S_IRWXU)
.with_context(|| format!("Open {} directory", path))
})?;