From 9f91a4df83a3fbc1861ec15eec5ecc4a667c1757 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 20 Jun 2017 16:04:38 -0700 Subject: [PATCH] Redox: Use create() instead of open() when setting env variable --- src/libstd/sys/redox/os.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs index 9d459581dd40c..e38b7b29f4837 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> { 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)?; }