Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/wasi' into feature/wasi
Browse files Browse the repository at this point in the history
  • Loading branch information
xmclark committed Apr 4, 2019
2 parents 207bd01 + c1c99db commit 2686322
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/wasi/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl WasiFs {
Ok(Self {
repo: RepoOpener::new()
.create(true)
.open("mem://foo", "")
.open("mem://wasmer-test-fs", "")
.map_err(|e| e.to_string())?,
name_map: HashMap::new(),
inodes: Arena::new(),
Expand Down
11 changes: 9 additions & 2 deletions lib/wasi/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub mod windows;
use self::types::*;
use crate::{
ptr::{Array, WasmPtr},
state::{Kind, WasiState, MAX_SYMLINKS},
state::{Fd, Kind, WasiState, MAX_SYMLINKS},
};
use rand::{thread_rng, Rng};
use std::cell::Cell;
Expand Down Expand Up @@ -768,7 +768,14 @@ pub fn fd_renumber(ctx: &mut Ctx, from: __wasi_fd_t, to: __wasi_fd_t) -> __wasi_
let state = get_wasi_state(ctx);
let fd_entry = wasi_try!(state.fs.fd_map.get(&from).ok_or(__WASI_EBADF));

state.fs.fd_map.insert(to, fd_entry.clone());
state.fs.fd_map.insert(
to,
Fd {
// TODO: verify this is correct
rights: fd_entry.rights_inheriting,
..*fd_entry
},
);
__WASI_ESUCCESS
}

Expand Down

0 comments on commit 2686322

Please sign in to comment.