Skip to content

Commit

Permalink
Auto merge of #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
bors committed Jun 22, 2017
2 parents ab5bec2 + 9f91a4d commit 7ef2b7b
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 7ef2b7b

Please sign in to comment.