Skip to content

Commit

Permalink
Merge pull request #3 from ids1024/redox-env
Browse files Browse the repository at this point in the history
Redox: Use create() instead of open() when setting env variable
  • Loading branch information
jackpot51 authored Jun 20, 2017
2 parents 247a018 + 9f91a4d commit d6aa888
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstd/sys/redox/os.rs
Original file line number Diff line number Diff line change
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 d6aa888

Please sign in to comment.