Rollup merge of #42783 - ids1024:redox-env, r=sfackler

Redox: Use create() instead of open() when setting env variable

See https://github.com/redox-os/kernel/pull/25.
This commit is contained in:
Mark Simulacrum 2017-06-23 06:02:08 -06:00 committed by GitHub
commit d22eb081ef

View File

@ -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)?;
}