Skip to content

Commit

Permalink
Rollup merge of rust-lang#42783 - ids1024:redox-env, r=sfackler
Browse files Browse the repository at this point in the history
Redox: Use create() instead of open() when setting env variable

See redox-os/kernel#25.
  • Loading branch information
Mark-Simulacrum committed Jun 22, 2017
2 parents 80f7aa1 + 9f91a4d commit 34d22cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstd/sys/redox/os.rs
Expand Up @@ -179,7 +179,7 @@ pub fn getenv(key: &OsStr) -> io::Result<Option<OsString>> {

pub fn setenv(key: &OsStr, value: &OsStr) -> io::Result<()> {
if ! key.is_empty() {
let mut file = ::fs::File::open(&("env:".to_owned() + key.to_str().unwrap()))?;
let mut file = ::fs::File::create(&("env:".to_owned() + key.to_str().unwrap()))?;
file.write_all(value.as_bytes())?;
file.set_len(value.len() as u64)?;
}
Expand Down

0 comments on commit 34d22cb

Please sign in to comment.