about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorIan Douglas Scott <ian@iandouglasscott.com>2017-06-20 16:04:38 -0700
committerIan Douglas Scott <ian@iandouglasscott.com>2017-06-20 16:04:38 -0700
commit9f91a4df83a3fbc1861ec15eec5ecc4a667c1757 (patch)
treed7404537d4007d032deeed50b95f47d2b2863f4b /src/libstd/sys
parent247a0184ff972f1205017185f6917a03b15e7be4 (diff)
downloadrust-9f91a4df83a3fbc1861ec15eec5ecc4a667c1757.tar.gz
rust-9f91a4df83a3fbc1861ec15eec5ecc4a667c1757.zip
Redox: Use create() instead of open() when setting env variable
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/redox/os.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs
index 9d459581dd4..e38b7b29f48 100644
--- a/src/libstd/sys/redox/os.rs
+++ b/src/libstd/sys/redox/os.rs
@@ -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)?;
     }