Skip to content

Commit 165a6e5

Browse files
committed
Fix wasi::fs::OpenOptions to imply write when append is on
1 parent 7f8ff84 commit 165a6e5

File tree

1 file changed

+5
-3
lines changed
  • library/std/src/sys/wasi

1 file changed

+5
-3
lines changed

Diff for: library/std/src/sys/wasi/fs.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub struct DirEntry {
4646
pub struct OpenOptions {
4747
read: bool,
4848
write: bool,
49+
append: bool,
4950
dirflags: wasi::Lookupflags,
5051
fdflags: wasi::Fdflags,
5152
oflags: wasi::Oflags,
@@ -270,8 +271,9 @@ impl OpenOptions {
270271
}
271272
}
272273

273-
pub fn append(&mut self, set: bool) {
274-
self.fdflag(wasi::FDFLAGS_APPEND, set);
274+
pub fn append(&mut self, append: bool) {
275+
self.append = append;
276+
self.fdflag(wasi::FDFLAGS_APPEND, append);
275277
}
276278

277279
pub fn dsync(&mut self, set: bool) {
@@ -321,7 +323,7 @@ impl OpenOptions {
321323
base |= wasi::RIGHTS_FD_READ;
322324
base |= wasi::RIGHTS_FD_READDIR;
323325
}
324-
if self.write {
326+
if self.write || self.append {
325327
base |= wasi::RIGHTS_FD_WRITE;
326328
base |= wasi::RIGHTS_FD_DATASYNC;
327329
base |= wasi::RIGHTS_FD_ALLOCATE;

0 commit comments

Comments
 (0)