diff options
author | Sascha Grunert <mail@saschagrunert.de> | 2017-02-23 20:31:27 +0100 |
---|---|---|
committer | Sascha Grunert <mail@saschagrunert.de> | 2017-02-23 20:31:27 +0100 |
commit | 2e6ac9d988aab42099a493a04842caf53ae55e8e (patch) | |
tree | bb4d746700f05846af45ec8642ac11c79fe9d99d | |
parent | Fixed license (diff) | |
download | wireguard-rs-2e6ac9d988aab42099a493a04842caf53ae55e8e.tar.xz wireguard-rs-2e6ac9d988aab42099a493a04842caf53ae55e8e.zip |
Check for the existence of /run first
-rw-r--r-- | src/lib.rs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -42,7 +42,12 @@ impl WireGuard { debug!("Created socket."); // Create the socket directory if not existing - let mut socket_path = PathBuf::from("/var").join("run").join("wireguard"); + let mut socket_path = if Path::new("/run").exists() { + PathBuf::from("/run") + } else { + PathBuf::from("/var").join("run") + }; + socket_path.join("wireguard"); if !socket_path.exists() { create_dir(&socket_path)?; debug!("Created socket path: {}", socket_path.display()); |