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

This commit is contained in:
Ian Douglas Scott 2017-06-20 16:04:38 -07:00
parent 247a0184ff
commit 9f91a4df83
No known key found for this signature in database
GPG Key ID: 4924E10E199B5959

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